‚̧Now Particularly Misnamed
    Wondering what‚Äôs next for npm?Check out our public roadmap! ¬Ľ

    node-simple-validator

    1.1.2¬†‚Äʬ†Public¬†‚Äʬ†Published

    node-simple-validator

    Version Downloads Test

    A simple data validator

    Validators

    • CPF
    • Email
    • Number
    • Number String (Example: "2500" or 2500)
    • String

    Installation

    # Using npm 
    npm install --save node-simple-validator
     
    # Using yarn 
    yarn add node-simple-validator

    To validate CPF

    const { isCpf } = require('node-simple-validator')
    isCpf('CPF')
    // if valid, return true

    To validate Email

    const { isEmail } = require('node-simple-validator')
    isEmail('valid@email.com') // true

    To validate Number

    const { isNumber } = require('node-simple-validator')
    isNumber(2500) // true

    To validate Number String

    const { isNumberString } = require('node-simple-validator')
    isNumberString("2500") // true
    isNumberString(2500) // true

    To validate String

    const { isString } = require('node-simple-validator')
    isString('valid string') // true
    isString('', { allowEmpty: true }) // true

    To more validations, you can contribute.

    Just open pull request with a new folder on src/validators path, write a validator function and modify index.js file in validators folder. The validator function must be return only a boolean.


    Run tests

    npm run test

    Install

    npm i node-simple-validator

    DownloadsWeekly Downloads

    17

    Version

    1.1.2

    License

    MIT

    Unpacked Size

    13 kB

    Total Files

    18

    Last publish

    Collaborators

    • avatar