schema-inspector
Advanced tools
Comparing version 1.4.6 to 1.4.7
{ | ||
"name": "schema-inspector", | ||
"version": "1.4.6", | ||
"version": "1.4.7", | ||
"homepage": "https://github.com/Atinux/schema-inspector", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -387,3 +387,3 @@ /* | ||
var _keys = schema.someKeys; | ||
if (typeof candidat !== 'object') { | ||
if (typeof candidat !== 'object' || candidat === null) { | ||
return; | ||
@@ -390,0 +390,0 @@ } |
var inspector = require('../'); | ||
var schema = { | ||
type: 'object', | ||
properties: { | ||
lorem: { type: 'string', eq: 'ipsum' }, | ||
dolor: { | ||
type: 'array', | ||
items: { type: 'number' } | ||
} | ||
} | ||
}; | ||
// var schema = { | ||
// type: 'object', | ||
// properties: { | ||
// lorem: { type: 'string', eq: 'ipsum' }, | ||
// dolor: { | ||
// type: 'array', | ||
// items: { type: 'number' } | ||
// } | ||
// } | ||
// }; | ||
var candidate = { | ||
lorem: 'not_ipsum', | ||
dolor: [ 12, 34, 'ERROR', 45, 'INVALID' ] | ||
}; | ||
var result = inspector.validate(schema, candidate, function (err, result) { | ||
console.log(result.format()); | ||
}); | ||
// var candidate = { | ||
// lorem: 'not_ipsum', | ||
// dolor: [ 12, 34, 'ERROR', 45, 'INVALID' ] | ||
// }; | ||
// var result = inspector.validate(schema, candidate, function (err, result) { | ||
// console.log(result.format()); | ||
// }); | ||
// var schema = { type: 'object', properties: { lol: { someKeys: ['pouet'] } } }; | ||
// var subject = { lol: null }; | ||
// inspector.validate(schema, subject); |
{ | ||
"name": "schema-inspector", | ||
"description": "Schema-Inspector is a powerful tool to sanitize and validate JS objects.", | ||
"version": "1.4.6", | ||
"version": "1.4.7", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "author": { |
299026
5321