You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
2.8 KiB
52 lines
2.8 KiB
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.encode = exports.decodeStrict = exports.decode = void 0;
|
|
var decode_1 = require("./decode");
|
|
var encode_1 = require("./encode");
|
|
/**
|
|
* Decodes a string with entities.
|
|
*
|
|
* @param data String to decode.
|
|
* @param level Optional level to decode at. 0 = XML, 1 = HTML. Default is 0.
|
|
*/
|
|
function decode(data, level) {
|
|
return (!level || level <= 0 ? decode_1.decodeXML : decode_1.decodeHTML)(data);
|
|
}
|
|
exports.decode = decode;
|
|
/**
|
|
* Decodes a string with entities. Does not allow missing trailing semicolons for entities.
|
|
*
|
|
* @param data String to decode.
|
|
* @param level Optional level to decode at. 0 = XML, 1 = HTML. Default is 0.
|
|
*/
|
|
function decodeStrict(data, level) {
|
|
return (!level || level <= 0 ? decode_1.decodeXML : decode_1.decodeHTMLStrict)(data);
|
|
}
|
|
exports.decodeStrict = decodeStrict;
|
|
/**
|
|
* Encodes a string with entities.
|
|
*
|
|
* @param data String to encode.
|
|
* @param level Optional level to encode at. 0 = XML, 1 = HTML. Default is 0.
|
|
*/
|
|
function encode(data, level) {
|
|
return (!level || level <= 0 ? encode_1.encodeXML : encode_1.encodeHTML)(data);
|
|
}
|
|
exports.encode = encode;
|
|
var encode_2 = require("./encode");
|
|
Object.defineProperty(exports, "encodeXML", { enumerable: true, get: function () { return encode_2.encodeXML; } });
|
|
Object.defineProperty(exports, "encodeHTML", { enumerable: true, get: function () { return encode_2.encodeHTML; } });
|
|
Object.defineProperty(exports, "escape", { enumerable: true, get: function () { return encode_2.escape; } });
|
|
// Legacy aliases
|
|
Object.defineProperty(exports, "encodeHTML4", { enumerable: true, get: function () { return encode_2.encodeHTML; } });
|
|
Object.defineProperty(exports, "encodeHTML5", { enumerable: true, get: function () { return encode_2.encodeHTML; } });
|
|
var decode_2 = require("./decode");
|
|
Object.defineProperty(exports, "decodeXML", { enumerable: true, get: function () { return decode_2.decodeXML; } });
|
|
Object.defineProperty(exports, "decodeHTML", { enumerable: true, get: function () { return decode_2.decodeHTML; } });
|
|
Object.defineProperty(exports, "decodeHTMLStrict", { enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } });
|
|
// Legacy aliases
|
|
Object.defineProperty(exports, "decodeHTML4", { enumerable: true, get: function () { return decode_2.decodeHTML; } });
|
|
Object.defineProperty(exports, "decodeHTML5", { enumerable: true, get: function () { return decode_2.decodeHTML; } });
|
|
Object.defineProperty(exports, "decodeHTML4Strict", { enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } });
|
|
Object.defineProperty(exports, "decodeHTML5Strict", { enumerable: true, get: function () { return decode_2.decodeHTMLStrict; } });
|
|
Object.defineProperty(exports, "decodeXMLStrict", { enumerable: true, get: function () { return decode_2.decodeXML; } });
|
|
|