New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

jsoncomparizer

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsoncomparizer

A lightweight npm package that takes two JSON objects and produces a human-friendly diff report

latest
npmnpm
Version
1.1.5
Version published
Maintainers
1
Created
Source

Jsoncomparizer

A lightweight npm package that takes two JSON objects and produces a human-friendly diff report.

Installation

 npm i jsoncomparizer
 npm install jsoncomparizer

Package 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 chalk@4.1.2

Output

output1

License

ISC

Feedback

If you have any feedback, please reach out to us at thebradredd@gmail.com

Keywords

json

FAQs

Package last updated on 18 Apr 2025

Did you know?

Socket

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.

Install

Related posts