0.0.4 • Published 26 days ago

json-diff-git v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
26 days ago

JSON Diff Git

This is a simple tool to compare two JSON objects and generate a diff in a format that similar to git diff.

Installation

npm install json-diff-git

Usage

import { diffToJson } from 'json-diff-git';

const before = { a: 1, b: 2, c: 3 };
const after = { a: 1, b: 3, d: 4 };

const result = await diffToJson(before, after);
consle.log(result);

Output

{
  "a": 1,
  - "b": 2,
  + "b": 3,
  - "c": 3,
  + "d": 4
}

use diffToHtml() to generate a HTML diff with syntax highlighting.

or use diff() to get a list of changes.

0.0.4

26 days ago

0.0.3

26 days ago

0.0.2

26 days ago

0.0.1

27 days ago