@lalit_npm/smooth-express-validator

1.1.5 • Public • Published

@lalit_npm/smooth-express-validator

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

Steps to install and use the package.

  1. open intgrated terminal and use

npm i @lalit_npm/smooth-express-validator

  1. require in your file where you want to use.

const validateInput = require('smooth-express-validator')

  1. 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 ' }

Readme

Keywords

none

Package Sidebar

Install

npm i @lalit_npm/smooth-express-validator

Weekly Downloads

0

Version

1.1.5

License

ISC

Unpacked Size

3.54 kB

Total Files

3

Last publish

Collaborators

  • lalit_npm