Socket
Book a DemoInstallSign in
Socket

compare_json

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compare_json

Checks JSON files within a path for duplicate keys and if all files within the same sub directory have the same keys.

0.0.6
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

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 = require('compare_json');
const path = 'lib/json'

compareJSON(path).then(function (jsonFaults) {
    console.log(jsonFaults);
}).catch(console.error);

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]
    }]
}

Grunt Plugin

grunt-compare_json

Keywords

JSON

FAQs

Package last updated on 25 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.