@types/ent
Version:
TypeScript definitions for ent
30 lines (25 loc) • 806 B
TypeScript
/**
* Options for the encode() function
*/
export interface EntOpts {
/**
* If opts.numeric is false or opts.named is true, encoding will used named codes like π.
*/
numeric?: boolean | undefined;
/**
* If opts.numeric is false or opts.named is true, encoding will used named codes like π.
*/
named?: boolean | undefined;
/**
* If opts.special is set to an Object, the key names will be forced to be encoded (defaults to forcing: <>'"&)
*/
special?: any;
}
/**
* Escape unsafe characters in str with html entities. By default, entities are encoded with numeric decimal codes
*/
export function encode(s: string, opts?: EntOpts): string;
/**
* Convert html entities in str back to raw text.
*/
export function decode(s: string): string;