1.0.0 • Published 1 year ago

numeric-validation v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Numeric validation

This package validates number based upon provided rules.

Installation 🐙

npm install numeric-validation

Usage 💡

When using with a valid number, you will get the number back without any extra characters

const numericValidation = require('numeric-validation')
const number = '2'

// function returns true/false
const flag = numericValidation(number, {
    greateThan: 5
})

console.log(`${number} is greater than 5: `, flag)

Multiple rules can be provided to validate number.

numericValidation(<number_to_validate>, {
    <rule_name>: <value>
})

Multiple rules can be provided to validate number.

1. greaterThan: pass number with this rule
2. equalTo: pass number with this rule
3. lesserThan: pass number with this rule
4. isInteger: pass true with this rule
5. isFloat: pass true with this rule
6. isNumber: pass true with this rule

Maintainers 👷

  1. Gaurav Chinawale
    • LinkedIn
    • Github

Dedicating this package to my boss Prashant Kamdar who compelled me to build this package.