https://github.com/grimen/node-document-validator-jsongate
Validator adapter `json-gate` for `node-document` ODM for Node.js.
https://github.com/grimen/node-document-validator-jsongate
Last synced: 10 months ago
JSON representation
Validator adapter `json-gate` for `node-document` ODM for Node.js.
- Host: GitHub
- URL: https://github.com/grimen/node-document-validator-jsongate
- Owner: grimen
- License: mit
- Created: 2013-05-01T19:39:38.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2013-11-29T13:40:57.000Z (over 12 years ago)
- Last Synced: 2025-05-05T05:48:46.450Z (about 1 year ago)
- Language: JavaScript
- Homepage: https://npmjs.org/package/node-document-validator-jsongate
- Size: 105 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
# NODE-DOCUMENT-VALIDATOR-JSONGATE [](http://travis-ci.org/grimen/node-document-validator-jsongate)
**Validator** adapter [json-gate](https://github.com/oferei/json-gate) for [node-document](https://github.com/grimen/node-document) ODM for Node.js.
## Installation
```shell
$ npm install node-document-validator-jsongate
```
## Usage
**Basic:**
```javascript
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](https://github.com/grimen/node-document).
## Test
**Local tests:**
```shell
$ make test
```
## License
Released under the MIT license.
Copyright (c) [Jonas Grimfelt](http://github.com/grimen)
[](https://bitdeli.com/free "Bitdeli Badge")