forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
js-schema.d.ts
50 lines (42 loc) · 1.29 KB
/
js-schema.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
// Type definitions for js-schema
// Project: https://github.com/molnarg/js-schema
// Definitions by: Marcin Porebski <https://github.com/marcinporebski>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'js-schema'
{
export interface Schema
{
(obj: any): boolean; // test obj against the schema
}
export default function schema(definition: any): Schema
}
interface NumberConstructor
{
min(n: number): NumberConstructor;
max(n: number): NumberConstructor;
below(n: number): NumberConstructor;
above(n: number): NumberConstructor;
step(n: number): NumberConstructor;
}
interface StringConstructor
{
of(charset: string): StringConstructor;
of(length: number, charset: string): StringConstructor;
of(minLength: number, maxLength: number, charset: string): StringConstructor;
}
interface ArrayConstructor
{
like(arr: Array<any>): ArrayConstructor;
of(pattern: any): ArrayConstructor;
of(length: number, pattern: any): ArrayConstructor;
of(minLength: number, maxLength: number, pattern: any): ArrayConstructor;
}
interface ObjectConstructor
{
like(obj: any): ObjectConstructor;
reference(obj: any): ObjectConstructor;
}
interface FunctionConstructor
{
reference(func: Function): FunctionConstructor;
}