A tool for files differences by parsing them into AST, sorting them, and comparing the stringified output. Useful for finding changes in configuration files.
npm install -g gendiff-blazecolour-2
npm install --save gendiff-blazecolour-2
$ gendiff [options] <file1> <file2>
import genDiff from 'gendiff-blazecolour-2';
genDiff('path/to/file1', 'path/to/file2', format);
-v, --version Output the version number
-f, --format [type] Output format: tree, plain, json (default: tree)
-h, --help Output usage information
The following extensions are available for input files:
- json
- yml
- ini
The output formats:
- tree
- plain
- json
Comparing two json files.
file1:
{
"host": "hexlet.io",
"timeout": 50,
"proxy": "123.234.53.22",
"follow": false
}
file2:
{
"timeout": 20,
"verbose": true,
"host": "hexlet.io"
}
tree format:
{
host: hexlet.io
+ timeout: 20
- timeout: 50
- proxy: 123.234.53.22
+ verbose: true
- follow: false
}
plain format:
Property 'timeout' was changed. From '50' to '20'
Property 'proxy' was deleted
Property 'follow' was deleted
Property 'verbose' was added with value: 'true'