@pedroruiz/validator
v1.0.1
Published
Simple and effective Validator
Downloads
5
Readme
Validator.js
Simple and very effective validator for JavaScript
Usage
import Validator from '[your-validator-path]
or
var validator = require([here-your-validator-path])
- type
- isString
- isAlphaNumeric
- isNumber
- isObject
- isBoolean
- isDate
- isEmail
- length
- lengthMoreThan
- lengthLessThan
- lengthEqualTo
- passwordMatch
- regExp
Type
Validator(your_variable).type();
isString
Validator('hello world').isString();
isAlphaNumeric
Validator('helloWorld).isAlphaNumeric();
isNumber
Validator(3.14).isNumber();
isObject
Validator([1,2,3]).isObject();
isBoolean
Validator(true).isBoolean();
isDate
Validator('12/15/2019).isDate('eu');
Validator('15/12/2019).isDate('us');
isEmail
Validator('[email protected]').isEmail();
length
Validator('hellow orld').length();
lengthMoreThan
Validator('world').lengthMoreThan(3);
lengthLessThan
Validator('world').lengthLessThan(8);
lengthEqualTo
Validator('world').lengthEqualTo(5);
passwordMatch
Validator('password').passwordMatch('password');
regExp
Validator('HelloWorld').regExp(/^[a-z0-9]+$/i)
Enjoy.