
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
rfc6902-json-diff
Advanced tools
Diff two JS objects and receive an RFC6902 JSON patch.
var diff = require("rfc6902-json-diff");
var patch = diff(
{ name: "CQQL", age: 21, likes: ["api stuff"] },
{ name: "CQQL", age: 22, likes: ["api stuff", "json"] }
);
console.log(patch);
//=> [{ op: "replace", path: "/age", value: 22 },
//=> { op: "add", path: "/likes/1", value: "json" }]
The current implementation only uses the add, remove and replace
operation. Usage of move and copy can and may be added later and I am always
open for pull requests, but they are not needed to generate patches for every
possible modification. Your patches will just be a bit bigger than they would
be with move and copy.
Arrays are diffed with the Levenshtein distance. This gives us
diff([1, 2, 3, 4, 5, 6], [1, 5, 2, 3, 4, 6]) == [
{ op: "add", path: "/1", value: 5 },
{ op: "remove", path: "/5" }
]
instead of 5 replace operations.
FAQs
JSON diff according to RFC6902
We found that rfc6902-json-diff demonstrated a not healthy version release cadence and project activity because the last version was released 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.