-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathindex.d.ts
41 lines (37 loc) · 953 Bytes
/
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
import { Request, Response, Handler } from 'express';
declare namespace ExpressMongoSanitize {
interface Options {
replaceWith?: string;
onSanitize?: (params: { key: string; req: Request }) => void;
dryRun?: boolean;
allowDots?: boolean;
}
}
type Middleware = {
/**
* Create middleware instance
* @param options
*/
(options?: ExpressMongoSanitize.Options): Handler;
/**
* Remove any keys containing prohibited characters
* @param target
* @param options
*/
sanitize<T extends Record<string, unknown> | unknown[]>(
target: T,
options?: ExpressMongoSanitize.Options,
): T;
/**
* Check if the payload has keys with prohibited characters‘
* @param target
*/
has(
target: Record<string, unknown> | unknown[],
allowDots?: boolean,
): boolean;
};
declare const ExpressMongoSanitize: Middleware & {
default: typeof ExpressMongoSanitize;
};
export = ExpressMongoSanitize;