@awesome-fe/translate
Version:
Translation utils
35 lines • 1.12 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SpecialChars = void 0;
var SpecialChars = /** @class */ (function () {
function SpecialChars() {
}
SpecialChars.encodeAttribute = function (text) {
return text.replace(/"/g, '"')
.replace(/'/g, ''');
};
SpecialChars.encodeText = function (text) {
return text.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>');
};
SpecialChars.encodeUrl = function (text) {
return encodeURI(this.decodeText(text));
};
SpecialChars.decodeText = function (text) {
return text.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>');
};
SpecialChars.decodeAttribute = function (text) {
return text
.replace(/"/g, '"')
.replace(/'/g, '\'');
};
SpecialChars.decodeUrl = function (text) {
return decodeURI(text);
};
return SpecialChars;
}());
exports.SpecialChars = SpecialChars;
//# sourceMappingURL=special-chars.js.map