jungles-validation

1.0.0 • Public • Published

Jungles Validation

You can find validators for jungles-validation at jungles-validators.

Api

var validators = require('jungles-validators');

var schema = {
  name: [ validators.required(), validators.string() ]
};

var data = {
  name: 'James'
};

var result = validate(data, schema);

result.valid(function (response) {
  // response: sanitized data
  // example: { name: 'James' }
});

result.invalid(function (errors) {
  // errors: object of arrays with errors
  // example: { name: [ 'String is required' ] }
});

Test

mocha.js and should.js is needed.

make test

Readme

Keywords

none

Package Sidebar

Install

npm i jungles-validation

Weekly Downloads

2

Version

1.0.0

License

none

Last publish

Collaborators

  • enome