0.0.9 • Published 3 years ago
alu-json-diff v0.0.9
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-diffUsage
Cli
alu-json-diff oldSourceDirPath newSourceDirPath -o ./distSimple 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: []
// }