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