forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sanitize-html.d.ts
58 lines (38 loc) · 1.5 KB
/
sanitize-html.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
53
54
55
56
57
58
// Type definitions for sanitize-html 1.13.0
// Project: https://github.com/punkave/sanitize-html
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>, Afshin Darian <https://github.com/afshin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function sanitize(dirty: string, options?: sanitize.IOptions): string;
declare namespace sanitize {
type Attributes = { [attr: string]: string };
type Tag = { tagName: string; attribs: Attributes; text?: string; };
type Transformer = (tagName: string, attribs: Attributes) => Tag;
interface IDefaults {
allowedAttributes: { [index: string]: string[] };
allowedSchemes: string[];
allowedSchemesByTag: { [index: string]: string[] };
allowedTags: string[];
selfClosing: string[];
}
interface IFrame {
tag: string;
attribs: { [index: string]: string };
text: string;
tagPosition: number;
}
interface IOptions {
allowedAttributes?: { [index: string]: string[] } | boolean;
allowedClasses?: { [index: string]: string[] } | boolean;
allowedSchemes?: string[] | boolean;
allowedTags?: string[] | boolean;
exclusiveFilter?: (frame: IFrame) => boolean;
nonTextTags?: string[];
selfClosing?: string[];
transformTags?: { [tagName: string]: string | Transformer };
}
var defaults: IDefaults;
function simpleTransform(tagName: string, attribs: Attributes, merge?: boolean): Transformer;
}
declare module 'sanitize-html' {
export = sanitize;
}