README
Validate all kind of your variable
Install
$ npm install --save sd-validation
Usage
const validator = require('sd-validation');
let number = 4
let decimal = 10.5
let string = "test"
let boolean = true
let email = "test@gmail.com"
let phone = "6289956189231"
let negative = -12
let array = [1,2,3]
let object = {a : 1}
console.log(validator.isArray(array)); //true
console.log(validator.isEmail(email)) // true
console.log(validator.isObject(object)) // true
console.log(validator.isObject(string)) // false
//...etc
SD-Validator Type Function
Below are special / custom functions to check data type
function | description | output |
---|---|---|
isNull(data) | check if value null or undefined | true/false |
isNumber(data) | check if value is number | true/false |
isDecimal(data) | check if value is decimal | true/false |
isString(data) | check if value is string | true/false |
isBoolean(data) | check if value is boolean | true/false |
isDate(data) | check if value is date | true/false |
isObject(data) | check if value is object | true/false |
isNestedObject(data) | check if value is nested object | true/false |
isArray(data) | check if value is array | true/false |
isNegative(data) | check if value is negative | true/false |
isEmail(data) | check if value is email | true/false |
isPhoneNumber(data) | check if value is phone number | true/false |
License
MIT © SDANALYZER