1.0.1 • Published 2 years ago

ntama v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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: 'parthka.2005@gmail.com',
    l_name: "None",
    mobile: "+918866881066",
    bod: 'Sun Oct 20 2007'
});

console.log(checkdata)

License

MIT License