Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Validator adapter `json-validate` for `node-document` ODM for Node.js.
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples
lib
test
.env
.gitignore
.travis.yml
MIT-LICENSE
Makefile
README.md
index.js
package.json

README.md

NODE-DOCUMENT-VALIDATOR-JSV Build Status

Validator adapter jsv for node-document ODM for Node.js.

Installation

  $ npm install node-document-validator-jsv

Usage

Basic:

  var Validator = require('node-document-validator-jsv');

  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);
  });

For details; see node-document.

Test

Local tests:

  $ make test

License

Released under the MIT license.

Copyright (c) Jonas Grimfelt

Bitdeli Badge

Something went wrong with that request. Please try again.