README
Valichain
Validator chain which wraps several functions of String, lodash and chriso/validator.
Installation
npm install valichain
Usage
var Valichain = require("valichain");
var _ = require("lodash");
// Reusable rules
var rules = {
command : new Valichain().default('play')
._$isNotNil().msg("Must not be null nor undefined")
.s$trim()
.v$isIn(['play', 'pause']).msg("Must be one of play or pause")
};
var data = {
// command : ''
};
data = Valichain.extract(Valichain.validate(rules, data));
console.log(data);
Documentation
For documentation of the Valichain class and its own methods, see doc.md. Besides, several methods of String, lodash and chriso/validator are wrapped and used with a prefix followed by a '