@types/insane
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Installation

npm install --save @types/insane

Summary

This package contains type definitions for insane (https://github.com/bevacqua/insane).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/insane.

// Type definitions for insane 1.0.0

type AllowedSchemes = "http" | "https" | "mailto";

type AllowedTags =
    | "*"
    | "a"
    | "abbr"
    | "article"
    | "b"
    | "blockquote"
    | "br"
    | "caption"
    | "code"
    | "del"
    | "details"
    | "div"
    | "em"
    | "h1"
    | "h2"
    | "h3"
    | "h4"
    | "h5"
    | "h6"
    | "hr"
    | "i"
    | "img"
    | "ins"
    | "kbd"
    | "li"
    | "main"
    | "ol"
    | "p"
    | "pre"
    | "section"
    | "span"
    | "strong"
    | "sub"
    | "summary"
    | "sup"
    | "table"
    | "tbody"
    | "td"
    | "th"
    | "thead"
    | "tr"
    | "u"
    | "ul";

type EmptyObject = Record<string, never>;

type AllowedAttributes = Record<AllowedTags, string[]>;

type AllowedClasses = Record<AllowedTags, string[]> | EmptyObject;

interface Token {
    attrs: Record<string, string>;
    tag: AllowedTags;
}

type Filter = (token: Token) => boolean;

type TransformText = (text: string) => string;

interface SanitizeOptions {
    allowedAttributes?: Partial<AllowedAttributes>;
    allowedClasses?: Partial<AllowedClasses>;
    allowedSchemes?: AllowedSchemes[];
    allowedTags?: AllowedTags[];
    filter?: Filter;
    transformText?: TransformText;
}

declare const defaults: SanitizeOptions;

export = insane;
declare function insane(html: string, options?: SanitizeOptions, strict?: boolean): string;
declare namespace insane {
    export {
        type AllowedAttributes,
        type AllowedClasses,
        type AllowedSchemes,
        type AllowedTags,
        defaults,
        type Filter,
        type SanitizeOptions,
        type TransformText,
    };
}

Additional Details

  • Last updated: Thu, 04 Apr 2024 17:07:00 GMT
  • Dependencies: none

Credits

These definitions were written by Eduardo Cancino-Zarate, and Nicolás Bevacqua.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/insane

Weekly Downloads

312

Version

1.0.0

License

MIT

Unpacked Size

6.03 kB

Total Files

5

Last publish

Collaborators

  • types