Validator Utility
Install
npm i --save @darkwolf/validator
Usage
const validator = require('@darkwolf/validator')
validator.isNumber(13)
validator.isString(21)
const { Validator } = validator
new Validator(69).isString().isValid
new Validator(69).isNumber().isRange(0, 100).isValid
new Validator('69')
.isNumber()
.call(validator => validator)
.throw(() => new TypeError('Value must be a number'))
Init
new Validator(value?)
Methods
setValue(value)
call(validator => validator)
throw(() => e)
isType(value?, type)
isObject(value?)
isUndefined(value?)
isBoolean(value?)
isNumber(value?)
isString(value?)
isFunction(value?)
isSymbol(value?)
isNull(value?)
isInstance(value?, instance)
isArray(value?)
isBuffer(value?)
isArrayBuffer(value?)
isRegExp(value?)
isSet(value?)
isExists(value?)
isNaN(value?)
isFinite(value?)
isInfinity(value?)
isMore(value?)
isLess(value?)
isEqual(value?)
isMoreEqual(value?)
isLessEqual(value?)
isRange(value?, min, max)