nodejs-input-validation
v2.1.6
Published
let validator = require('nodejs-input-validation');
Downloads
11
Maintainers
Readme
nodejs-input-validation
let validator = require('nodejs-input-validation');
let name = "edi";
let username = "edison";
let email = "[email protected]";
let mobile = "9987456321";
let password = "123456";
let age = "12";
let average = "123456.910";
let skype = " ";
let currency = "100,000,000.00";
let alphanumeric = "csc45435";
let float = "12.992";
let lowercase = "ewewe";
let uppercase = "AAAA";
let mongoid = "5e37fd30b3fc1f4515d23157";
let int = "1";
let ip = "49.207.1.119";
let status = 'true'; // 'true','false','0','1'
let body = { name, username, email, mobile, password, age, average, skype, currency, alphanumeric, float, lowercase, mongoid, int, ip, status, uppercase,
}
let v = validator.check(body,{
name: 'required|minLength:3',
username: 'required|maxLength:7',
email: 'required|email',
mobile: 'required|mobile',
password: 'required',
age: 'required|number',
average: 'required|decimal',
skype: 'required|empty',
currency: 'required|currency',
alphanumeric: 'required|alphanumeric',
float: 'required|float',
lowercase: 'required|lowercase',
mongoid: 'required|mongoid',
int: 'required|int',
ip: 'required|ip',
status: 'required|boolean',
uppercase: 'required|uppercase',
});
console.log(v);
Copyright
Copyright © 2020 naveenedi