1var validator = require('./') 2 3var validate = validator({ 4 type: 'object', 5 properties: { 6 hello: { 7 required: true, 8 type: 'string' 9 } 10 } 11}) 12 13console.log('should be valid', validate({hello: 'world'})) 14console.log('should not be valid', validate({})) 15 16// get the last error message by checking validate.error 17// the following will print "data.hello is required" 18console.log('the errors were:', validate.errors) 19 20