fix #60 typings
This commit is contained in:
7
typings/tsconfig.json
Normal file
7
typings/tsconfig.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"strictNullChecks": true,
|
||||
"noImplicitAny": true,
|
||||
"module": "commonjs"
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,20 @@ console.log(xss('hello', {
|
||||
css: false,
|
||||
}));
|
||||
|
||||
xss('hello');
|
||||
xss('hello', {
|
||||
escapeHtml(str) {
|
||||
return str.trim();
|
||||
},
|
||||
stripBlankChar: true,
|
||||
onTag(tag, html, options) {
|
||||
return html;
|
||||
},
|
||||
onIgnoreTag(tag, html) {
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
interface ICustomWhiteList extends XSS.IWhiteList {
|
||||
view?: string[];
|
||||
|
||||
8
typings/xss.d.ts
vendored
8
typings/xss.d.ts
vendored
@@ -86,9 +86,9 @@ declare namespace XSS {
|
||||
video?: string[];
|
||||
}
|
||||
|
||||
export type OnTagHandler = (tag: string, html: string, options: {}) => string;
|
||||
export type OnTagHandler = (tag: string, html: string, options: {}) => string | void;
|
||||
|
||||
export type OnTagAttrHandler = (tag: string, name: string, value: string) => string;
|
||||
export type OnTagAttrHandler = (tag: string, name: string, value: string) => string | void;
|
||||
|
||||
export type SafeAttrValueHandler = (tag: string, name: string, value: string, cssFilter: ICSSFilter) => string;
|
||||
|
||||
@@ -106,7 +106,7 @@ declare module 'xss' {
|
||||
onIgnoreTag(tag: string, html: string, options: {
|
||||
position: number;
|
||||
isClosing: boolean;
|
||||
});
|
||||
}): string;
|
||||
remove(html: string): string;
|
||||
};
|
||||
|
||||
@@ -119,7 +119,7 @@ declare module 'xss' {
|
||||
(html: string, options?: XSS.IFilterXSSOptions): string;
|
||||
|
||||
FilterXSS: typeof FilterXSS;
|
||||
parseTag(html: string, onTag: (sourcePosition: number, position: number, tag: string, html: string, isClosing: boolean) => string, escapeHtml: EscapeHandler): string;
|
||||
parseTag(html: string, onTag: (sourcePosition: number, position: number, tag: string, html: string, isClosing: boolean) => string, escapeHtml: XSS.EscapeHandler): string;
|
||||
parseAttr(html: string, onAttr: (name: string, value: string) => string): string;
|
||||
whiteList: XSS.IWhiteList;
|
||||
getDefaultWhiteList(): XSS.IWhiteList;
|
||||
|
||||
Reference in New Issue
Block a user