value-validate
v1.1.2
Published
value validate tool
Downloads
7
Readme
value-validate
Verify that a value matches the rules.
###Install
$ npm install value-validate --save
# or
$ yarn add value-validate
###Usage
import { validation } from 'value-validate';
/**
*
* @param {String} value String that need to be validated
* @param {Object|String} rules Validation rules
*/
validation(
'[email protected]',
['required', { type: 'email', msg: 'Please input the correct email format!'}],
result => console.log(result);
);
####Rules
required
email
phone
number
number-gt-#{number}
number-it-#{number}
number-gts-#{number}
number-its-#{number}
####Callback
retrun { isPass: [Bool], mag: [String] }