node-document-validator-jsongate

0.1.0 • Public • Published

NODE-DOCUMENT-VALIDATOR-JSONGATE Build Status

Validator adapter json-gate for node-document ODM for Node.js.

Installation

  $ npm install node-document-validator-jsongate

Usage

Basic:

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

  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

Readme

Keywords

none

Package Sidebar

Install

npm i node-document-validator-jsongate

Weekly Downloads

1

Version

0.1.0

License

none

Last publish

Collaborators

  • grimen