UNPKG

@awesome-fe/translate

Version:
35 lines 1.12 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SpecialChars = void 0; var SpecialChars = /** @class */ (function () { function SpecialChars() { } SpecialChars.encodeAttribute = function (text) { return text.replace(/"/g, '&quot;') .replace(/'/g, '&#39;'); }; SpecialChars.encodeText = function (text) { return text.replace(/&/g, '&amp;') .replace(/</g, '&lt;') .replace(/>/g, '&gt;'); }; SpecialChars.encodeUrl = function (text) { return encodeURI(this.decodeText(text)); }; SpecialChars.decodeText = function (text) { return text.replace(/&amp;/g, '&') .replace(/&lt;/g, '<') .replace(/&gt;/g, '>'); }; SpecialChars.decodeAttribute = function (text) { return text .replace(/&quot;/g, '"') .replace(/&#39;/g, '\''); }; SpecialChars.decodeUrl = function (text) { return decodeURI(text); }; return SpecialChars; }()); exports.SpecialChars = SpecialChars; //# sourceMappingURL=special-chars.js.map