Sha256: 694e99f5343a856c093d9dfe45873ca3bcd2bc4260238230704ae8fa84377513

Contents?: true

Size: 590 Bytes

Versions: 34

Compression:

Stored size: 590 Bytes

Contents

'use strict'

var schemas = require('./schemas')
var ValidationError = require('./error')
var validator = require('is-my-json-valid')

module.exports = function (schema, data, cb) {
  // default value
  var valid = false

  // validator config
  var validate = validator(schema, {
    greedy: true,
    verbose: true,
    schemas: schemas
  })

  // execute is-my-json-valid
  if (data !== undefined) {
    valid = validate(data)
  }

  // callback?
  if (typeof cb === 'function') {
    return cb(validate.errors ? new ValidationError(validate.errors) : null, valid)
  }

  return valid
}

Version data entries

34 entries across 29 versions & 8 rubygems

Version Path
optimacms-0.4.3 spec/dummy/node_modules/har-validator/lib/runner.js
optimacms-0.4.2 spec/dummy/node_modules/har-validator/lib/runner.js
locomotivecms-3.4.0 app/javascript/node_modules/node-sass/node_modules/har-validator/lib/runner.js
lanes-0.8.0 node_modules/fsevents/node_modules/har-validator/lib/runner.js
lanes-0.8.0 node_modules/har-validator/lib/runner.js
node-compiler-0.9.1 vendor/node/deps/npm/node_modules/request/node_modules/har-validator/lib/runner.js
node-compiler-0.9.0 vendor/node-v7.2.1/deps/npm/node_modules/request/node_modules/har-validator/lib/runner.js
select_all-rails-0.3.1 node_modules/har-validator/lib/runner.js
node-compiler-0.8.0 vendor/node-v7.2.0/deps/npm/node_modules/request/node_modules/har-validator/lib/runner.js
node-compiler-0.7.0 vendor/node-v7.1.0/deps/npm/node_modules/request/node_modules/har-validator/lib/runner.js
node-compiler-0.7.0 vendor/node-v6.9.1/deps/npm/node_modules/request/node_modules/har-validator/lib/runner.js
tck-lambdas-0.3.10 lib/tck/lambdas/chistacojs/source/node_modules/request/node_modules/har-validator/lib/runner.js
tck-lambdas-0.3.9 lib/tck/lambdas/chistacojs/source/node_modules/request/node_modules/har-validator/lib/runner.js
tck-lambdas-0.3.8 lib/tck/lambdas/chistacojs/source/node_modules/request/node_modules/har-validator/lib/runner.js
tck-lambdas-0.3.7 lib/tck/lambdas/chistacojs/source/node_modules/request/node_modules/har-validator/lib/runner.js
tck-lambdas-0.3.6 lib/tck/lambdas/chistacojs/source/node_modules/request/node_modules/har-validator/lib/runner.js
tck-lambdas-0.3.5 lib/tck/lambdas/chistacojs/source/node_modules/request/node_modules/har-validator/lib/runner.js
tck-lambdas-0.3.4 lib/tck/lambdas/chistacojs/source/node_modules/request/node_modules/har-validator/lib/runner.js
tck-lambdas-0.3.3 lib/tck/lambdas/chistacojs/source/node_modules/request/node_modules/har-validator/lib/runner.js
tck-lambdas-0.3.2 lib/tck/lambdas/chistacojs/source/node_modules/request/node_modules/har-validator/lib/runner.js