index.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.decodeXMLStrict = exports.decodeHTML5Strict = exports.decodeHTML4Strict = exports.decodeHTML5 = exports.decodeHTML4 = exports.decodeHTMLStrict = exports.decodeHTML = exports.decodeXML = exports.encodeHTML5 = exports.encodeHTML4 = exports.escapeUTF8 = exports.escape = exports.encodeNonAsciiHTML = exports.encodeHTML = exports.encodeXML = exports.encode = exports.decodeStrict = exports.decode = void 0;
  4. var decode_1 = require("./decode");
  5. var encode_1 = require("./encode");
  6. /**
  7. * Decodes a string with entities.
  8. *
  9. * @param data String to decode.
  10. * @param level Optional level to decode at. 0 = XML, 1 = HTML. Default is 0.
  11. * @deprecated Use `decodeXML` or `decodeHTML` directly.
  12. */
  13. function decode(data, level) {
  14. return (!level || level <= 0 ? decode_1.decodeXML : decode_1.decodeHTML)(data);
  15. }
  16. exports.decode = decode;
  17. /**
  18. * Decodes a string with entities. Does not allow missing trailing semicolons for entities.
  19. *
  20. * @param data String to decode.
  21. * @param level Optional level to decode at. 0 = XML, 1 = HTML. Default is 0.
  22. * @deprecated Use `decodeHTMLStrict` or `decodeXML` directly.
  23. */
  24. function decodeStrict(data, level) {
  25. return (!level || level <= 0 ? decode_1.decodeXML : decode_1.decodeHTMLStrict)(data);
  26. }
  27. exports.decodeStrict = decodeStrict;
  28. /**
  29. * Encodes a string with entities.
  30. *
  31. * @param data String to encode.
  32. * @param level Optional level to encode at. 0 = XML, 1 = HTML. Default is 0.
  33. * @deprecated Use `encodeHTML`, `encodeXML` or `encodeNonAsciiHTML` directly.
  34. */
  35. function encode(data, level) {
  36. return (!level || level <= 0 ? encode_1.encodeXML : encode_1.encodeHTML)(data);
  37. }
  38. exports.encode = encode;
  39. var encode_2 = require("./encode");
  40. Object.defineProperty(exports, "encodeXML", { enumerable: true, get: function () { return encode_2.encodeXML; } });
  41. Object.defineProperty(exports, "encodeHTML", { enumerable: true, get: function () { return encode_2.encodeHTML; } });
  42. Object.defineProperty(exports, "encodeNonAsciiHTML", { enumerable: true, get: function () { return encode_2.encodeNonAsciiHTML; } });
  43. Object.defineProperty(exports, "escape", { enumerable: true, get: function () { return encode_2.escape; } });
  44. Object.defineProperty(exports, "escapeUTF8", { enumerable: true, get: function () { return encode_2.escapeUTF8; } });
  45. // Legacy aliases (deprecated)
  46. Object.defineProperty(exports, "encodeHTML4", { enumerable: true, get: function () { return encode_2.encodeHTML; } });
  47. Object.defineProperty(exports, "encodeHTML5", { enumerable: true, get: function () { return encode_2.encodeHTML; } });
  48. var decode_2 = require("./decode");
  49. Object.defineProperty(exports, "decodeXML", { enumerable: true, get: function () { return decode_2.decodeXML; } });
  50. Object.defineProperty(exports, "decodeHTML", { enumerable: true, get: function () { return decode_2.decodeHTML; } });
  51. Object.defineProperty(exports, "decodeHTMLStrict", { enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } });
  52. // Legacy aliases (deprecated)
  53. Object.defineProperty(exports, "decodeHTML4", { enumerable: true, get: function () { return decode_2.decodeHTML; } });
  54. Object.defineProperty(exports, "decodeHTML5", { enumerable: true, get: function () { return decode_2.decodeHTML; } });
  55. Object.defineProperty(exports, "decodeHTML4Strict", { enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } });
  56. Object.defineProperty(exports, "decodeHTML5Strict", { enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } });
  57. Object.defineProperty(exports, "decodeXMLStrict", { enumerable: true, get: function () { return decode_2.decodeXML; } });