mirror of
https://github.com/thewesker/bug-em.git
synced 2025-12-20 20:21:05 -05:00
lol
This commit is contained in:
18
node_modules/is-my-json-valid/example.js
generated
vendored
Normal file
18
node_modules/is-my-json-valid/example.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
var validator = require('./')
|
||||
|
||||
var validate = validator({
|
||||
type: 'object',
|
||||
properties: {
|
||||
hello: {
|
||||
required: true,
|
||||
type: 'string'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
console.log('should be valid', validate({hello: 'world'}))
|
||||
console.log('should not be valid', validate({}))
|
||||
|
||||
// get the last error message by checking validate.error
|
||||
// the following will print "data.hello is required"
|
||||
console.log('the errors were:', validate.errors)
|
||||
Reference in New Issue
Block a user