encode.d.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * Encodes all non-ASCII characters, as well as characters not valid in XML
  3. * documents using XML entities.
  4. *
  5. * If a character has no equivalent entity, a
  6. * numeric hexadecimal reference (eg. `ü`) will be used.
  7. */
  8. export declare function encodeXML(str: string): string;
  9. /**
  10. * Encodes all entities and non-ASCII characters in the input.
  11. *
  12. * This includes characters that are valid ASCII characters in HTML documents.
  13. * For example `#` will be encoded as `#`. To get a more compact output,
  14. * consider using the `encodeNonAsciiHTML` function.
  15. *
  16. * If a character has no equivalent entity, a
  17. * numeric hexadecimal reference (eg. `ü`) will be used.
  18. */
  19. export declare function encodeHTML(data: string): string;
  20. /**
  21. * Encodes all non-ASCII characters, as well as characters not valid in HTML
  22. * documents using HTML entities.
  23. *
  24. * If a character has no equivalent entity, a
  25. * numeric hexadecimal reference (eg. `ü`) will be used.
  26. */
  27. export declare function encodeNonAsciiHTML(data: string): string;
  28. /**
  29. * Encodes all non-ASCII characters, as well as characters not valid in XML
  30. * documents using numeric hexadecimal reference (eg. `ü`).
  31. *
  32. * Have a look at `escapeUTF8` if you want a more concise output at the expense
  33. * of reduced transportability.
  34. *
  35. * @param data String to escape.
  36. */
  37. export declare const escape: typeof encodeXML;
  38. /**
  39. * Encodes all characters not valid in XML documents using XML entities.
  40. *
  41. * Note that the output will be character-set dependent.
  42. *
  43. * @param data String to escape.
  44. */
  45. export declare function escapeUTF8(data: string): string;
  46. //# sourceMappingURL=encode.d.ts.map