@lalit_npm/smooth-express-validator
v1.1.5
Published
The package provides you facilitates you for the validation of below listed text fields. 1. blank, null fields of any type, 2. text, 3. number, 4. email, 5. mobile, 6. alphanumeric
Downloads
5
Readme
@lalit_npm/smooth-express-validator
The package provides you facilitates you for the validation of below listed text fields.
- blank, null fields of any type,
- text,
- number,
- email,
- mobile,
- alphanumeric
Steps to install and use the package.
- open intgrated terminal and use
npm i @lalit_npm/smooth-express-validator
- require in your file where you want to use.
const validateInput = require('smooth-express-validator')
- provide arguments to the imported module.
var valresp = validateInput('field_value_to_check','type_of_field')
field_value_to_check -- Actual value to check type_of_field -- can be use for above listed all types.
You will get the response in variable and can use it.
will get Response.
you will get isValidate and message key where, isValidate -- boolean value which ensures, whether the fields is valid or not. message [optional, appear while error only] -- the actual error message for the field.
example
const validateInput = require('smooth-express-validator')
example 1.
var valresp = validateInput('test','text') console.log(valresp); // { isValidate: true }
example 2.
var valresp = validateInput('test1234','text') console.log(valresp); // {isValidate: false, message: 'test1234 should contain only letters ' }