alu-json-diff
v0.0.9
Published
json diff tool
Downloads
5
Readme
alu-json-diff
Use the command line to compare two folders with the same directory structure and output their differences
If used alone, you can compare two json objects and output the difference (added, removed, edited)
Installation
npm install -g alu-json-diff
Usage
Cli
alu-json-diff oldSourceDirPath newSourceDirPath -o ./dist
Simple usage:
import { diff } from "alu-json-diff";
const struct1 = {
a: 1,
b: [{ c1: [{ c3: { c5: [1, 2, { c6: 3 }] } }, { c4: 6 }] }, { c2: 2 }],
};
const struct2 = {
a: 11,
b: [{ c1: [{ c3: { c5: [1, 2, { c6: 4 }] } }, { c4: 6 }] }, { c2: 2 }],
};
let result = diff(struct1, struct2);
console.log(result);
// {
// edited: [
// ['a', 1, 11],
// ['b[0]/c1[0]/c3/c5[2]/c6', 3, 4]
// ],
// added: [],
// removed: []
// }