1.0.1 • Published 8 years ago
simple-custom-validator v1.0.1
simple-custom-validator
Simple validator with custom strategies
what?
this is not a complete validator lib/component, it can be used to make up your custom completely Validator
how
- install
npm i simple-custom-validator --save
usage
var Validator = require('simple-custom-validator') var validator = new Validator(['required', 'maxLength::5', 'notEqualTo::{someValue}']) console.log(validator.check('abc')) //true console.log(validator.check('')) //false console.log(validator.check('abcdefg')) //false console.log(validator.check('abc'), {someValue: 'abc'}) //false
strategies
- built-in strategies
custom strategy
var Validator = require('simple-custom-validator') var validator = new Validator(['pattern::yourCustomPatternHere'])