1.0.3 • Published 4 years ago
tspace-validator v1.0.3
tspace-validator
Validate REST API
Install
Install with npm:
npm install tspace-validator --save
Usage
// const { Validate , Validator } = require('tspace-validator')
import { Validate , Validator } from 'tspace-validator'
const data = {
email : 'test',
mobile : 'test',
username : 'username_test',
password : ''
}
try {
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().regex('\\S+@\\S+\\.\\S+')
})
} catch (err) {
console.log(err)
}