compareJSON
Checks JSON files within a path for duplicate keys and if all files within the same sub directory have the same keys.
Usage
Here is an example call of compare_json
:
const compareJSON = ;const path = 'lib/json' ;
Note:
Non JSON files will be ignored.
The object will contain { path: '/absolute/path/you/initially/passed/', duplicate: [], missing: [] }
if an empty
directory or a directory without JSON files is passed. Also the object will look the same if no faults are detected.
If something faulty is detected the object will look something like this:
path: '/absolute/path/you/initially/passed/' duplicate: file: '/absolute/path/to/a/json/file/containing/duplicate/keys.json' duplicateKeys: Array missing: file: '/absolute/path/to/a/json/file/which/is/missing/keys/another/json/file/in/the/same/location/contains.json' missingKeys: Array