/validate-object

Validate javascript objects with a schema object.

Primary LanguageJavaScript

validator-object

Validate objects with a schema object.

Basic Example

var { validateObject } = require('validate-object')

var obj = {
  name: "Ben",
  age: 30,
  born: 1990
}

var schema = {
  keys: {
    name: "String",  // uses libs own provided built in test function
    age: Number      // uses instanceof check
  }
}

console.log(validateObject(obj, schema)) // -> true