UNPKG

@awesome-fe/translate

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