https://github.com/grimen/node-document-validator-jsv
Validator adapter `json-validate` for `node-document` ODM for Node.js.
https://github.com/grimen/node-document-validator-jsv
Last synced: 10 months ago
JSON representation
Validator adapter `json-validate` for `node-document` ODM for Node.js.
- Host: GitHub
- URL: https://github.com/grimen/node-document-validator-jsv
- Owner: grimen
- License: mit
- Created: 2013-01-08T19:54:02.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2013-11-29T13:41:56.000Z (about 12 years ago)
- Last Synced: 2025-02-12T10:10:44.626Z (11 months ago)
- Language: JavaScript
- Homepage: https://npmjs.org/package/node-document-validator-jsv
- Size: 145 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
# NODE-DOCUMENT-VALIDATOR-JSV [](http://travis-ci.org/grimen/node-document-validator-jsv)
**Validator** adapter [jsv](https://github.com/garycourt/JSV) for [node-document](https://github.com/grimen/node-document) ODM for Node.js.
## Installation
```shell
$ npm install node-document-validator-jsv
```
## Usage
**Basic:**
```javascript
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](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")