1 | export interface Indexable {
|
2 | [key: string]: any;
|
3 | }
|
4 | export interface ValidationError {
|
5 | error: string;
|
6 | message?: string;
|
7 | path?: string;
|
8 | value: any;
|
9 | }
|
10 | export interface Validator {
|
11 | (value: any): ValidationError[] | undefined;
|
12 | }
|
13 | export interface ErrorMessageCallback {
|
14 | (error: string, value: any): string | undefined;
|
15 | }
|
16 | export interface Options {
|
17 | message?: string | ErrorMessageCallback;
|
18 | }
|
19 | export interface Schema {
|
20 | [key: string]: Validator;
|
21 | }
|
22 | export declare function matchesBoolean(options?: Options): Validator;
|
23 | export declare function matchesString(options?: Options): Validator;
|
24 | export declare function matchesPositiveInteger(options?: Options): Validator;
|
25 | export declare function matchesPositiveNumber(options?: Options): Validator;
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 | export declare function matchesEnum(types: Indexable, options?: Options): Validator;
|
32 | export declare function matchesArray(validator?: Validator, options?: Options): Validator;
|
33 | export declare function matchesObject(schema: Schema, options?: Options): Validator;
|
34 | export declare function makeOptional(validator: Validator): (value: any) => ValidationError[] | undefined;
|
35 | export declare function composeSchemas(...validators: Validator[]): Validator;
|
36 | export declare function validate(obj: any, validator: Validator | Validator): {
|
37 | path: string | undefined;
|
38 | error: string;
|
39 | message?: string | undefined;
|
40 | value: any;
|
41 | }[] | undefined;
|