4.1.4 • Published 2 years 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
| CustomValidatorExamples
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 years ago
4.1.3
2 years ago
4.1.0
2 years ago
4.1.2
2 years ago
4.1.1
2 years ago
4.0.0
3 years ago
3.1.5
5 years ago
3.1.4
5 years ago
3.1.3
5 years ago
3.1.2
5 years ago
3.1.1
5 years ago
3.1.0
5 years ago
3.0.1
5 years ago
3.0.0
5 years ago
2.2.0
5 years ago
2.1.0
5 years ago
2.0.0
5 years ago
1.1.0
5 years ago
1.0.1
5 years ago
1.0.0
5 years ago