4.1.4 • Published 2 months ago
tn-validate v4.1.4
Main module - validate()
import { validate } from 'tn-validate'
const value: any
const criteria: Criterion[]
validate(value, ...criteria)
Singular Modules
Better TypeScript Support with singular modules
isString()
isSymbol()
isNumber()
isBoolean()
isFunction()
isUndefined()
isNull()
isArray()
isObject()
isRegExp()
isDate()
isValidDate()
isJson()
isNumString()
isArrObject()
isNullUndefined()
isStrArr()
isNumArr()
isBoolArr()
isNumStrArr()
Type Criterion
type CustomValidator = (value: number) => boolean
type Criterion =
| 'string'
| StringConstructor
| 'number'
| NumberConstructor
| 'boolean'
| BooleanConstructor
| 'function'
| FunctionConstructor
| 'array'
| ArrayConstructor
| 'object'
| ObjectConstructor
| 'regexp'
| RegExpConstructor
| 'date'
| DateConstructor
| 'valid-date'
| 'json'
| 'null'
| 'undefined'
| RegExp
| CustomValidator
Examples
validate('any')
validate('string', String)
validate('school', String, Boolean)
validate(50, Number, val => val > 0 && val < 100)
validate('{}', 'json')
validate(/^\w+$/, RegExp)
validate('foo-bar', /^foo-.+/)
4.1.4
2 months ago
4.1.3
4 months ago
4.1.0
4 months ago
4.1.2
4 months ago
4.1.1
4 months ago
4.0.0
1 year ago
3.1.5
3 years ago
3.1.4
4 years ago
3.1.3
4 years ago
3.1.2
4 years ago
3.1.1
4 years ago
3.1.0
4 years ago
3.0.1
4 years ago
3.0.0
4 years ago
2.2.0
4 years ago
2.1.0
4 years ago
2.0.0
4 years ago
1.1.0
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago