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-object-diff-mod
A mod of Matt Phillips' deep-object-diff package: Deep diffs two objects, including nested structures of arrays and objects, and return the difference.
arr-diff
Returns an array with only the unique values from the first array, by excluding all values from additional arrays using strict equality for comparisons.
diff-match-patch
npm package for https://github.com/google/diff-match-patch
deep-diff
Javascript utility for calculating deep difference, capturing changes, and applying changes across objects; for nodejs and the browser.
Deep diffs two objects, including nested structures of arrays and objects, and returns the difference. ❄️
npm install deep-object-diff
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
1,065 Stars
114 Commits
89 Forks
11 Watching
10 Branches
8 Contributors
Updated on 22 Nov 2024
Minified
Minified + Gzipped
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
2.8%
607,391
Compared to previous day
Last week
2.2%
3,060,379
Compared to previous week
Last month
17.2%
12,911,203
Compared to previous month
Last year
8.9%
125,936,713
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
The latest stable version of the package.
Stable Version
1
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
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Reason
security policy file not detected
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
11 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
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