Ensure that two JavaScript files containing objects have the same keys and display differences.
We use it at @Bringr for diffing i18n files.
npm install jsobjectdiff -g
$ jsobjectdiff
config argument is required
Usage: node jsobjectdiff [options]
Options:
-c, --config JSON configuration path
Where the configuration file must be something like:
{
"pre": "(function (Bringr) {",
"post": "return Bringr;})({});",
"files": [{
"filePath": "./fixtures/en_US.js",
"objectPath": "i18n.en_US"
}, {
"filePath": "./fixtures/fr_FR.js",
"objectPath": "i18n.fr_FR"
}]
}
- pre/post: javacript code that will wrap the file content in order to yield the object
- files: an array of files to compare along with their object path
The file ./fixtures/en_US.js have 1 key(s) added line(s) : 6
Keys : SEARCH_TEMPLATE_INTRO
The file ./fixtures/fr_FR.js have 1 key(s) added line(s) : 6
Keys : SEARCH_SOURCES_RESERVED_INTRO
- Laura Felix <laura.felix.loratus[$-at-$]gmail.com>
- Nicolas Bruel <bruel.nicolas85[$-at-$]gmail.com>
- Francois-Guillaume Ribreau <npm[$-at-$]fgribreau.com> (http://fgribreau.com/)