one
Version:
One is a new React Framework that makes Vite serve both native and web.
22 lines (21 loc) • 558 B
JavaScript
const ESCAPE_LOOKUP = {
"&": "\\u0026",
// &
"<": "\\u003c",
// <
">": "\\u003e",
// >
"\u2028": "\\u2028",
// Line separator
"\u2029": "\\u2029"
// Paragraph separator
},
ESCAPE_REGEX = /[\u0026\u003c\u003e\u2028\u2029]/g;
function htmlEscapeJsonString(str) {
return str.replace(ESCAPE_REGEX, match => ESCAPE_LOOKUP[match]);
}
function safeJsonStringify(value) {
return htmlEscapeJsonString(JSON.stringify(value));
}
export { htmlEscapeJsonString, safeJsonStringify };
//# sourceMappingURL=htmlEscape.mjs.map