1 | /**
|
2 | * @param status the status code
|
3 | * @param msg the message of the error, defaulting to node's text for that status code
|
4 | * @param opts custom properties to attach to the error object
|
5 | */
|
6 | declare function assert(value: any, status?: number, msg?: string, opts?: Record<string, any>): asserts value;
|
7 | declare function assert(value: any, status?: number, opts?: Record<string, any>): asserts value;
|
8 |
|
9 | declare namespace assert {
|
10 | /**
|
11 | * @param status the status code
|
12 | * @param msg the message of the error, defaulting to node's text for that status code
|
13 | * @param opts custom properties to attach to the error object
|
14 | */
|
15 | type Assert = <T>(a: T, b: T, status?: number, msg?: string, opts?: Record<string, any>) => void;
|
16 |
|
17 | /**
|
18 | * @param status the status code
|
19 | * @param msg the message of the error, defaulting to node's text for that status code
|
20 | * @param opts custom properties to attach to the error object
|
21 | */
|
22 | type AssertOK = (a: any, status?: number, msg?: string, opts?: Record<string, any>) => asserts a;
|
23 |
|
24 | /**
|
25 | * @param status the status code
|
26 | * @param msg the message of the error, defaulting to node's text for that status code
|
27 | * @param opts custom properties to attach to the error object
|
28 | */
|
29 | type AssertEqual = (a: any, b: any, status?: number, msg?: string, opts?: Record<string, any>) => void;
|
30 |
|
31 | const equal: Assert;
|
32 | const notEqual: Assert;
|
33 | const ok: AssertOK;
|
34 | const strictEqual: AssertEqual;
|
35 | const notStrictEqual: AssertEqual;
|
36 | const deepEqual: AssertEqual;
|
37 | const notDeepEqual: AssertEqual;
|
38 | }
|
39 |
|
40 | export = assert;
|