1.0.0 • Published 3 years ago
sspace-validate v1.0.0
sspace-validate
Validate REST API
Install
Install with npm:
npm install sspace-validate --save
Usage
import { Validate , Validator } from 'sspace-validate'
const data = {
email : 'test',
mobile : 'test',
username : 'usernametest',
password : '',
password_confirm : 'password'
}
const validate = new Validator().check(data ,{
email : new Validate().required('validate message').email(),
mobile : new Validate().required().number()
username : new Validate().required().min(3).max(5)
password : new Validate().required().confirm('password_confirm','password not match'),
password_confirm : new Validate().required()
})
if(validate->fails()) {
console.log(validate->errors())
throw ...
}
1.0.0
3 years ago