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