Validate

Validate a package.json object.

Usage

var isValid = require( '@stdlib/_tools/package-json/validate' );

isValid( pkg )

Validates a package.json object.

var pkg = {
    'name': 'beep',
    'version': '0.0.0'
};

var bool = isValid( pkg );
// returns <boolean>

var errs = isValid.errors;
// returns <Array> || null

Examples

var isValid = require( '@stdlib/_tools/package-json/validate' );

var pkg = require( './package.json' );

var bool = isValid( pkg );
var errs = isValid.errors;

CLI

Usage

Usage: validate-package-json [options] [json]

Options:

  -h,    --help                Print this message.
  -V,    --version             Print the package version.

Notes

  • If successful, the program prints true to stdout. If not successful, the program prints validation errors to stderr.

Examples

$ validate-package-json "$(cat ./package.json)"