mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Add typings for sanitize-html
This commit is contained in:
parent
7d298be1db
commit
71b9e552ea
@ -619,6 +619,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
|
||||
* [:link:](rx/rx.virtualtime.d.ts) [RxJS-VirtualTime](http://rx.codeplex.com) by [gsino](http://www.codeplex.com/site/users/view/gsino), [Igor Oleinikov](https://github.com/Igorbek)
|
||||
* [:link:](sammyjs/sammyjs.d.ts) [Sammy.js](http://sammyjs.org) by [Boris Yankov](https://github.com/borisyankov), [Oisin Grehan](https://github.com/oising)
|
||||
* [:link:](sanitize-filename/sanitize-filename.d.ts) [sanitize-filename](https://github.com/parshap/node-sanitize-filename) by [Wim Looman](https://github.com/Nemo157)
|
||||
* [:link:](sanitize-html/sanitize-html.d.ts) [sanitize-html](https://github.com/punkave/sanitize-html) by [rogierschouten](https://github.com/rogierschouten)
|
||||
* [:link:](screenfull/screenfull.d.ts) [screenfull.js](https://github.com/sindresorhus/screenfull.js) by [Ilia Choly](http://github.com/icholy)
|
||||
* [:link:](select2/select2.d.ts) [Select2](http://ivaynberg.github.com/select2) by [Boris Yankov](https://github.com/borisyankov)
|
||||
* [:link:](selectize/selectize.d.ts) [Selectize](https://github.com/brianreavis/selectize.js) by [Adi Dahiya](https://github.com/adidahiya)
|
||||
|
||||
33
sanitize-html/sanitize-html-tests.ts
Normal file
33
sanitize-html/sanitize-html-tests.ts
Normal file
@ -0,0 +1,33 @@
|
||||
/// <reference path="sanitize-html.d.ts" />
|
||||
|
||||
import sanitizeHtml = require('sanitize-html');
|
||||
|
||||
var s: string;
|
||||
var t: string;
|
||||
|
||||
t = sanitizeHtml(s);
|
||||
t = sanitizeHtml(s, {
|
||||
});
|
||||
t = sanitizeHtml(s, {
|
||||
allowedTags: ["a", "br"],
|
||||
allowedSchemes: ["http"],
|
||||
allowedAttributes: { "a": ["href"] },
|
||||
allowedClasses: { "a": ["someclass"] },
|
||||
transformTags: {
|
||||
"a": "b",
|
||||
"br": function(tagName: string, attributes: {[index: string]: string}): { tagName: string; attributes: {[index: string]: string};} {
|
||||
return { tagName: tagName, attributes: attributes };
|
||||
}
|
||||
},
|
||||
exclusiveFilter: {
|
||||
"a": function(frame: {
|
||||
tag: string;
|
||||
attribs: { [index: string]: string };
|
||||
text: string;
|
||||
tagPosition: number;
|
||||
}): boolean {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
27
sanitize-html/sanitize-html.d.ts
vendored
Normal file
27
sanitize-html/sanitize-html.d.ts
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
// Type definitions for sanitize-html 1.6.0
|
||||
// Project: https://github.com/punkave/sanitize-html
|
||||
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
declare module "sanitize-html" {
|
||||
|
||||
function sanitizeHtml(s: string, opts?: {
|
||||
allowedTags?: string[];
|
||||
allowedSchemes?: string[];
|
||||
allowedAttributes?: { [index: string]: string[] };
|
||||
allowedClasses?: { [index: string]: string[] };
|
||||
transformTags?: { [index: string]: any };
|
||||
exclusiveFilter?: {
|
||||
[index: string]: (frame: {
|
||||
tag: string;
|
||||
attribs: { [index: string]: string };
|
||||
text: string;
|
||||
tagPosition: number;
|
||||
}) => boolean
|
||||
};
|
||||
|
||||
}): string;
|
||||
|
||||
export = sanitizeHtml;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user