valid-object
v2.0.0
Published
Validate the property types of an object against a schema.
Downloads
4
Maintainers
Readme
valid-object
Validate the property types of an object against a schema.
Installation
npm install valid-object
Usage
var validObject = require('valid-object')
var schema = {
name: { type: 'string' }
}
validObject({ name: 'Anonymous' }, schema)
// => true
validObject({ name: 1337 }, schema)
// => [
// {
// property: 'name',
// value: 1337,
// type: {
// expected: 'string',
// actual: 'number'
// }
// }
// ]