UNPKG

node-document-validator-amanda

Version:

Validator adapter `amanda` for `node-document` ODM for Node.js.

29 lines (23 loc) 405 B
var Validator = require('..'); var validator = new Validator(); var data = { foo: "foo", bar: 123, baz: undefined }; var schema = { foo: { type: "string", minLength: 4 }, bar: { type: "number" }, baz: { required: true } }; validator.validate(data, schema, function(err, errors, valid) { console.log("Valid: %s \nErrors:\n", valid, errors); process.exit(1); });