-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
51 lines (42 loc) · 1.23 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
41
42
43
44
45
46
47
48
49
50
51
import type { Response } from 'supertest';
function rewriteBody(
rewrite: Record<string, rewriteBody.RewriteValue>,
opts?: { log: boolean },
): (res: Response) => void;
namespace rewriteBody {
interface RewriteValue<T = any> {
// add(key: string, validate: (value: T) => boolean): this,
transform(transform: (value: any) => T): this,
validate(validate: (value: T) => boolean): this,
value(value: T): this,
}
function string(): RewriteValue<string> & {
lowercase(): this,
uppercase(): this,
email(): this,
url(): this,
matches(match: string | string[] | RegExp): this,
startsWith(prefix: string): this,
endsWith(suffix: string): this,
in(values: string[] | Set<string>): this,
};
function number(): RewriteValue<number> & {
positive(): this,
negative(): this,
lt(lt: number): this,
lte(lte: number): this,
gt(gt: number): this,
gte(gte: number): this,
in(values: number[] | Set<number>): this,
};
function boolean(): RewriteValue<boolean>;
function date(): RewriteValue<Date> & {
today(): this,
lt(lt: Date): this,
lte(lte: Date): this,
gt(gt: Date): this,
gte(gte: Date): this,
within(ms: number): this,
};
}
export = rewriteBody;