assert-my-json-valid
Use is-my-json-valid to validate, throw if error
Install
$ npm install --save assert-my-json-valid
Usage
var assertMyJsonValid = var schema = type: 'string' try catch e console // => 'string data is the wrong type (value: 1)' // no error
API
assertMyJsonValid(schema, value)
-> output
Validates value
against schema
and throws a ValidationError if not valid.
It will only create a JSON validator once for each schema
reference.
License
MIT © Andrew Joslin