-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidator.d.ts
More file actions
64 lines (49 loc) · 1.88 KB
/
validator.d.ts
File metadata and controls
64 lines (49 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
declare namespace validator {
export interface ValidatorObject {
[propName: string]: any
}
export type ValidatorBuiltInRegexRules = 'objectId' | 'email' | 'alpha' | 'alphaNum' | 'alphaDash' | 'chs' | 'chsAlpha' | 'chsAlphaNum' | 'chsDash' | 'url' | 'date'
export type ValidatorBuiltInRules = ValidatorBuiltInRegexRules | 'array' | 'string' | 'number' | 'integer' | 'safeInteger' | 'float' | 'boolean' | 'trueValue' | 'falseValue' | 'required' | 'notEmpty' | 'in' | 'between' | 'minimum' | 'maximum' | 'length' | 'minLength' | 'maxLength'
export type ValidatorMode = 'all' | 'step' | 'single'
export interface ValidatorErrorResult {
[propName: string]: Array<string>
}
export type ValidatorResult = false | ValidatorErrorResult
export interface ValidatorRuleObject {
format?: any,
message?: string
}
export interface ValidatorOptions {
mode?: ValidatorMode,
locale?: ValidatorObject
}
export interface Validator {
(source: ValidatorObject, constraints: ValidatorObject, options?: ValidatorOptions): ValidatorResult
version: string
getObjectValue(key:string, source:any):any
ucfirst(value:string):string
isRegexp(value:any):boolean
isString(value:any):boolean
isNull(value:any):boolean
isEmpty(value:any):boolean
isObject(value:any):boolean
isPlainObject(value:any):boolean
isArray(value:any):boolean
isPrimitive(value:any):boolean
isFunction(value:any):boolean
isNumber(value:any):boolean
isInteger(value:any):boolean
isFloat(value:any):boolean
isSafeInteger(value:any):boolean
isTrue(value:any):boolean
isFalse(value:any):boolean
isBoolean(value:any):boolean
isNaN(value:any):boolean
isEmail(value:any):boolean
isObjectId(value:any):boolean
isUrl(value:any):boolean
isDate(value:any):boolean
}
}
declare const validator: validator.Validator
export = validator