jsoncomparizer
v1.1.5
Published
A lightweight npm package that takes two JSON objects and produces a human-friendly diff report
Maintainers
Readme
Jsoncomparizer
A lightweight npm package that takes two JSON objects and produces a human-friendly diff report.
Installation
npm i jsoncomparizer
npm install jsoncomparizerPackage usage
const { diff } = require('jsoncomparizer');
const obj1 = { name: "Alice", age: 25 };
const obj2 = { name: "Alice", age: 26, city: "Wonderland" };
console.log(diff(obj1, obj2));
options argument
const { diff } = require('jsoncomparizer');
const chalk = require('chalk');
const obj1 = { name: "Alice", age: 25 };
const obj2 = { name: "Alice", age: 26, city: "Wonderland" };
const options = {
// the user-provided name that will be formatted with magenta
// You can override styling like this:
// added: text => chalk.bgGreen.black(text)
// removed: text => chalk.bgRed.white(text)
// changed: text => chalk.bgCyanBright.black(text)
// path: text => chalk.underline.cyan(text)
};
console.log(diff(obj1, obj2, options));
Note : Use Chalk (4.1.2) for active options.
npm i [email protected]Output

License
Feedback
If you have any feedback, please reach out to us at [email protected]
