
Research
/Security News
737 Chrome VPN Extensions Linked to Brand Impersonation and Browser Traffic Redirection
The campaign amassed more than 75,000 installs by targeting Russian-speaking users seeking access to blocked services.
deep-diff-patch
Advanced tools
Compute a minimal JSON-serializable diff between objects and apply it as a patch
Compute a minimal JSON-serializable diff between objects and apply it as a patch
npm install deep-diff-patch
import {diff, patch} from 'deep-diff-patch';
const oldObject = {name: 'Alice', age: 30, city: 'NYC'};
const newObject = {name: 'Alice', age: 31, email: 'alice@test.com'};
const operations = diff(oldObject, newObject);
//=> [
// {op: 'replace', path: '/age', value: 31},
// {op: 'add', path: '/email', value: 'alice@test.com'},
// {op: 'remove', path: '/city'}
// ]
const result = patch(oldObject, operations);
//=> {name: 'Alice', age: 31, email: 'alice@test.com'}
Returns an array of operations describing the changes from oldObject to newObject.
Each operation has the shape {op, path, value?} where:
op is 'add', 'remove', or 'replace'path uses JSON Pointer format (RFC 6901): /key/nested/0value is present for add and replace operationsRecursively compares nested objects and arrays (by index).
Applies an array of operations to a deep clone of object and returns the new object. The input is never mutated.
Alias for patch.
MIT
FAQs
Compute a minimal JSON-serializable diff between objects and apply it as a patch
The npm package deep-diff-patch receives a total of 1 weekly downloads. As such, deep-diff-patch popularity was classified as not popular.
We found that deep-diff-patch demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
The campaign amassed more than 75,000 installs by targeting Russian-speaking users seeking access to blocked services.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.