-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
40 lines (33 loc) · 1.01 KB
/
index.d.ts
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
export interface ValidatorExtensionContext {
name: string
value: any
type: string
length: number
parent: {
name: string
type: string
},
}
export interface ValidatorExtension {
(ctx: ValidatorExtensionContext, ...args: any): {
message: string,
pass: boolean,
value: any,
};
}
export interface ValidatorExtensionCollection {
[name: string]: ValidatorExtension
}
// Placeholder for now.
export interface PropertyValidator {
[name: string]: Function
}
export interface ArgumentCollection {
assert: (argName: string, argValue?: any) => PropertyValidator;
expect: (argName: string, argValue?: any) => PropertyValidator;
update: (newArgs: object) => this;
extend: (extensions: ValidatorExtensionCollection) => this;
}
export declare function isRequired(pointer: string, override: boolean): void;
export declare function assert(argName: string, argValue: any, parentName?: string, parentType?: string): PropertyValidator;
export default function validate(args: object): ArgumentCollection;