<commit_before>JSON structural diff
====================

Does exactly what you think it does:

![Screenshot](https://github.com/andreyvit/json-diff/raw/master/doc/screenshot.png)


Installation
------------

    npm install json-diff


Usage
-----

Simple:

    json-diff a.json b.json

Detailed:

    % json-diff --help
    Usage: json-diff [-vjC] first.json second.json

    Arguments:
      first.json            Old file
      second.json           New file

    General options:
      -v, --verbose         Output progress info
      -C, --[no-]color      Colored output
      -j, --raw-json        Display raw JSON encoding of the diff
      -h, --help            Display this usage information


Features
--------

* colorized, diff-like output
* fuzzy matching of modified array elements (when array elements are object hierarchies)
* reasonable test coverage (far from 100%, though)


Tests
-----

Run:

    `npm test`

Output:

    colorize
      ✓ should return ' <value>' for a scalar value
      ✓ should return '-<old value>', '+<new value>' for a scalar diff
      ✓ should return '-<removed key>: <removed value>' for an object diff with a removed key
      ✓ should return '+<added key>: <added value>' for an object diff with an added key
      ✓ should return '+<added key>: <added stringified value>' for an object diff with an added key and a non-scalar value
      ✓ should return ' <modified key>: <colorized diff>' for an object diff with a modified key
      ✓ should return '+<inserted item>' for an array diff
      ✓ should return '-<deleted item>' for an array diff

    diff
      with simple scalar values
        ✓ should return undefined for two identical numbers
        ✓ should return undefined for two identical strings<commit_msg>README: Fix 'npm test' string<commit_after>JSON structural diff
====================

Does exactly what you think it does:

![Screenshot](https://github.com/andreyvit/json-diff/raw/master/doc/screenshot.png)


Installation
------------

    npm install json-diff


Usage
-----

Simple:

    json-diff a.json b.json

Detailed:

    % json-diff --help
    Usage: json-diff [-vjC] first.json second.json

    Arguments:
      first.json            Old file
      second.json           New file

    General options:
      -v, --verbose         Output progress info
      -C, --[no-]color      Colored output
      -j, --raw-json        Display raw JSON encoding of the diff
      -h, --help            Display this usage information


Features
--------

* colorized, diff-like output
* fuzzy matching of modified array elements (when array elements are object hierarchies)
* reasonable test coverage (far from 100%, though)


Tests
-----

Run:

    npm test

Output:

    colorize
      ✓ should return ' <value>' for a scalar value
      ✓ should return '-<old value>', '+<new value>' for a scalar diff
      ✓ should return '-<removed key>: <removed value>' for an object diff with a removed key
      ✓ should return '+<added key>: <added value>' for an object diff with an added key
      ✓ should return '+<added key>: <added stringified value>' for an object diff with an added key and a non-scalar value
      ✓ should return ' <modified key>: <colorized diff>' for an object diff with a modified key
      ✓ should return '+<inserted item>' for an array diff
      ✓ should return '-<deleted item>' for an array diff

    diff
      with simple scalar values
        ✓ should return undefined for two identical numbers
        ✓ should return undefined for two identical strings
{'fraction_non_alphanumeric': 0.10951576576576577, 'fraction_numerical': 0.0016891891891891893, 'mean_word_length': 2.4461687681862267, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6826261', 'n_tokens_mistral': 974, 'n_tokens_neox': 942, 'n_words': 429}