2.1.1 • Published 9 years ago

jsobjectdiff v2.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
9 years ago

jsobjectdiff Build Status Deps Version

Ensure that two JavaScript files containing objects have the same keys and display differences.

We use it at @Bringr for diffing i18n files.

Setup

npm install jsobjectdiff -g

Usage

$ 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

Output sample

  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

Contributors