Gathering detailed insights and metrics for deep-object-diff
Gathering detailed insights and metrics for deep-object-diff
Gathering detailed insights and metrics for deep-object-diff
Gathering detailed insights and metrics for deep-object-diff
Deep diffs two objects, including nested structures of arrays and objects, and returns the difference. ❄️
npm install deep-object-diff
Typescript
Module System
Node Version
NPM Version
100
Supply Chain
100
Quality
76.1
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
679,874,919
Last Day
132,755
Last Week
2,973,450
Last Month
12,952,318
Last Year
138,505,459
MIT License
1,105 Stars
114 Commits
96 Forks
10 Watchers
10 Branches
7 Contributors
Updated on Jun 27, 2025
Minified
Minified + Gzipped
Latest Version
1.1.9
Package Id
deep-object-diff@1.1.9
Unpacked Size
22.75 kB
Size
4.74 kB
File Count
24
NPM Version
8.15.0
Node Version
16.17.0
Cumulative downloads
Total Downloads
Last Day
-2.7%
132,755
Compared to previous day
Last Week
-9%
2,973,450
Compared to previous week
Last Month
3.2%
12,952,318
Compared to previous month
Last Year
17.7%
138,505,459
Compared to previous year
No dependencies detected.
❄️
Deep diff two JavaScript Objects
A small library that can deep diff two JavaScript Objects, including nested structures of arrays and objects.
yarn add deep-object-diff
npm i --save deep-object-diff
diff(originalObj, updatedObj)
returns the difference of the original and updated objects
addedDiff(original, updatedObj)
returns only the values added to the updated object
deletedDiff(original, updatedObj)
returns only the values deleted in the updated object
updatedDiff(original, updatedObj)
returns only the values that have been changed in the updated object
detailedDiff(original, updatedObj)
returns an object with the added, deleted and updated differences
1import { diff, addedDiff, deletedDiff, updatedDiff, detailedDiff } from 'deep-object-diff';
diff
:1const lhs = { 2 foo: { 3 bar: { 4 a: ['a', 'b'], 5 b: 2, 6 c: ['x', 'y'], 7 e: 100 // deleted 8 } 9 }, 10 buzz: 'world' 11}; 12 13const rhs = { 14 foo: { 15 bar: { 16 a: ['a'], // index 1 ('b') deleted 17 b: 2, // unchanged 18 c: ['x', 'y', 'z'], // 'z' added 19 d: 'Hello, world!' // added 20 } 21 }, 22 buzz: 'fizz' // updated 23}; 24 25console.log(diff(lhs, rhs)); // => 26/* 27{ 28 foo: { 29 bar: { 30 a: { 31 '1': undefined 32 }, 33 c: { 34 '2': 'z' 35 }, 36 d: 'Hello, world!', 37 e: undefined 38 } 39 }, 40 buzz: 'fizz' 41} 42*/
addedDiff
:1const lhs = { 2 foo: { 3 bar: { 4 a: ['a', 'b'], 5 b: 2, 6 c: ['x', 'y'], 7 e: 100 // deleted 8 } 9 }, 10 buzz: 'world' 11}; 12 13const rhs = { 14 foo: { 15 bar: { 16 a: ['a'], // index 1 ('b') deleted 17 b: 2, // unchanged 18 c: ['x', 'y', 'z'], // 'z' added 19 d: 'Hello, world!' // added 20 } 21 }, 22 buzz: 'fizz' // updated 23}; 24 25console.log(addedDiff(lhs, rhs)); 26 27/* 28{ 29 foo: { 30 bar: { 31 c: { 32 '2': 'z' 33 }, 34 d: 'Hello, world!' 35 } 36 } 37} 38*/
deletedDiff
:1const lhs = { 2 foo: { 3 bar: { 4 a: ['a', 'b'], 5 b: 2, 6 c: ['x', 'y'], 7 e: 100 // deleted 8 } 9 }, 10 buzz: 'world' 11}; 12 13const rhs = { 14 foo: { 15 bar: { 16 a: ['a'], // index 1 ('b') deleted 17 b: 2, // unchanged 18 c: ['x', 'y', 'z'], // 'z' added 19 d: 'Hello, world!' // added 20 } 21 }, 22 buzz: 'fizz' // updated 23}; 24 25console.log(deletedDiff(lhs, rhs)); 26 27/* 28{ 29 foo: { 30 bar: { 31 a: { 32 '1': undefined 33 }, 34 e: undefined 35 } 36 } 37} 38*/
updatedDiff
:1const lhs = { 2 foo: { 3 bar: { 4 a: ['a', 'b'], 5 b: 2, 6 c: ['x', 'y'], 7 e: 100 // deleted 8 } 9 }, 10 buzz: 'world' 11}; 12 13const rhs = { 14 foo: { 15 bar: { 16 a: ['a'], // index 1 ('b') deleted 17 b: 2, // unchanged 18 c: ['x', 'y', 'z'], // 'z' added 19 d: 'Hello, world!' // added 20 } 21 }, 22 buzz: 'fizz' // updated 23}; 24 25console.log(updatedDiff(lhs, rhs)); 26 27/* 28{ 29 buzz: 'fizz' 30} 31*/
detailedDiff
:1const lhs = { 2 foo: { 3 bar: { 4 a: ['a', 'b'], 5 b: 2, 6 c: ['x', 'y'], 7 e: 100 // deleted 8 } 9 }, 10 buzz: 'world' 11}; 12 13const rhs = { 14 foo: { 15 bar: { 16 a: ['a'], // index 1 ('b') deleted 17 b: 2, // unchanged 18 c: ['x', 'y', 'z'], // 'z' added 19 d: 'Hello, world!' // added 20 } 21 }, 22 buzz: 'fizz' // updated 23}; 24 25console.log(detailedDiff(lhs, rhs)); 26 27/* 28{ 29 added: { 30 foo: { 31 bar: { 32 c: { 33 '2': 'z' 34 }, 35 d: 'Hello, world!' 36 } 37 } 38 }, 39 deleted: { 40 foo: { 41 bar: { 42 a: { 43 '1': undefined 44 }, 45 e: undefined 46 } 47 } 48 }, 49 updated: { 50 buzz: 'fizz' 51 } 52} 53*/
MIT
5.3/10
Summary
deep-object-diff vulnerable to Prototype Pollution
Affected Versions
>= 1.1.6, < 1.1.9
Patched Versions
1.1.9
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
Found 4/27 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
13 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More@airthium/deep-object-diff
Deep diffs two objects, including nested structures of arrays and objects, and return the difference.
fast-object-diff
Flat and deep object diffs with filers.
recursive-diff
Find diff between any two variables where variables be any valid JavaScript data type like string, numeric, array or object
@raw2dd4/deep-object-diff
Deep diffs two objects, including nested structures of arrays and objects, and return the difference.