UNPKG

969 BTypeScriptView Raw
1export declare type Level = 'xml' | 'html4' | 'html5' | 'all';
2interface CommonOptions {
3 level?: Level;
4}
5export declare type EncodeMode = 'specialChars' | 'nonAscii' | 'nonAsciiPrintable' | 'extensive';
6export interface EncodeOptions extends CommonOptions {
7 mode?: EncodeMode;
8 numeric?: 'decimal' | 'hexadecimal';
9}
10export declare type DecodeScope = 'strict' | 'body' | 'attribute';
11export interface DecodeOptions extends CommonOptions {
12 scope?: DecodeScope;
13}
14/** Encodes all the necessary (specified by `level`) characters in the text */
15export declare function encode(text: string | undefined | null, { mode, numeric, level }?: EncodeOptions): string;
16/** Decodes a single entity */
17export declare function decodeEntity(entity: string | undefined | null, { level }?: CommonOptions): string;
18/** Decodes all entities in the text */
19export declare function decode(text: string | undefined | null, { level, scope }?: DecodeOptions): string;
20export {};