ntama
v1.0.1
Published
Field Checker for node.js
Downloads
2
Maintainers
Readme
Ntama
Installation
npm install ntama
Example
//import natama
const ntama = require("ntama");
//Define restrictions
const restrictions = {
f_name: {
type: 'string'
},
l_name: {
optional: true,
},
username: {
type: 'string',
min: 7,
max: 20
},
email: {
type: 'email'
},
mobile: {
optional: true,
type: 'phone'
},
bod: {
type: 'date'
}
}
//Generate validator by the restrictions
const field = ntama(restrictions)
//Then perform validation
const checkdata = field.check({
username: "parthka",
f_name: "Parthka",
email: '[email protected]',
l_name: "None",
mobile: "+918866881066",
bod: 'Sun Oct 20 2007'
});
console.log(checkdata)
License
MIT License