/json-diff

Stdout difference from two JS Objects in the TTY

Primary LanguageJavaScriptMIT LicenseMIT

Json-diff

version Maintenance MIT size dep known vulnerabilities Build Status

Differentiates JSON in you terminal with color.

Requirements

Getting Started

This package is available in the Node Package Repository and can be easily installed with npm or yarn.

$ npm i @slimio/json-diff
# or
$ yarn add @slimio/json-diff

Usage example

const jsonDiff = require("@slimio/json-diff");
const json1 = {
    number: 10,
    array: ["x", "y", "z"]
}

const json2 = {
    number: 20,
    array: ["x", "y", "w"]
}

jsonDiff(json1, json2);

It will produce the following stdout:

stdout

API

jsonDiff(original: object, diff: object, options?: Options): void

Stdout the difference between two JSON Object. Available options is described by the following TypeScript interface

interface Options {
    color?: boolean;
}

Dependencies

Name Refactoring Security Risk Usage
kleur Minor Low TTY color

License

MIT