sanitize-html.d.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Type definitions for sanitize-html 1.12.0
  2. // Project: https://github.com/punkave/sanitize-html
  3. declare function sanitize(dirty: string, options?: sanitize.IOptions): string;
  4. declare namespace sanitize {
  5. export
  6. type Attributes = { [attr: string]: string };
  7. export
  8. type Tag = { tagName: string; attributes: Attributes; };
  9. export
  10. type Transformer = (tagName: string, attributes: Attributes) => Tag;
  11. export
  12. interface IDefaults {
  13. allowedAttributes: { [index: string]: string[] };
  14. allowedSchemes: string[];
  15. allowedSchemesByTag: { [index: string]: string[] };
  16. allowedTags: string[];
  17. selfClosing: string[];
  18. }
  19. export
  20. interface IFrame {
  21. tag: string;
  22. attributes: { [index: string]: string };
  23. text: string;
  24. tagPosition: number;
  25. }
  26. export
  27. interface IOptions {
  28. allowedAttributes?: { [index: string]: string[] };
  29. allowedClasses?: { [index: string]: string[] };
  30. allowedSchemes?: string[];
  31. allowedTags?: string[];
  32. exclusiveFilter?: (frame: IFrame) => boolean;
  33. selfClosing?: string[];
  34. transformTags?: { [tagName: string]: string | Transformer; };
  35. }
  36. export
  37. var defaults: IDefaults;
  38. export
  39. function simpleTransform(tagName: string, attributes: Attributes, merge?: boolean): Transformer;
  40. }
  41. declare module 'sanitize-html' {
  42. export = sanitize;
  43. }