DenReg/jsx-html/nodejs/node/utils/htmlEncode.js

12 lines
511 B
JavaScript
Raw Normal View History

2020-10-14 00:56:11 +00:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.htmlEncode = exports.doubleQuoteEncode = void 0;
function doubleQuoteEncode(text) {
return text.replace(/"/g, '"');
}
exports.doubleQuoteEncode = doubleQuoteEncode;
function htmlEncode(text) {
return doubleQuoteEncode(text.replace(/&/g, '&amp;').replace(/\//g, '&#x2F;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/'/g, '&#39;'));
}
exports.htmlEncode = htmlEncode;
//# sourceMappingURL=htmlEncode.js.map