forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jsen.d.ts
52 lines (43 loc) · 1.32 KB
/
jsen.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
41
42
43
44
45
46
47
48
49
50
51
52
// Type definitions for jsen (JSON Sentinel)
// Project: https://github.com/bugventure/jsen
// Definitions by: Vladimir Đokić <https://github.com/vladeck/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module Jsen {
export interface JsenFormats {
[key: string]: string | RegExp | Function;
}
export interface JsenSettings {
missing$Ref?: boolean;
greedy?: boolean;
formats?: JsenFormats;
schemas?: any;
}
export interface JsenBuildSettings {
copy?: boolean;
additionalProperties?: boolean;
}
export interface JsenValidator {
(data?: any): boolean;
build(initial?: any, options?: JsenBuildSettings): any;
errors: JsenValidateError[];
}
export interface JsenValidateError {
path: string;
keyword: string;
message?: string;
}
export interface JsenUnique {
(array: any[]): boolean;
findIndex(array: any[], value: any, comparator: (obj1: any, obj2: any) => boolean): number;
}
export interface JsenMain {
(schema?: any, options?: JsenSettings): JsenValidator;
clone(data: any): any;
equal(a: any, b: any): boolean;
unique: JsenUnique;
}
}
declare module "jsen" {
var _jsen: Jsen.JsenMain;
export = _jsen;
}