UNPKG

one

Version:

One is a new React Framework that makes Vite serve both native and web.

45 lines 1.47 kB
var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: !0 }); }, __copyProps = (to, from, except, desc) => { if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); return to; }; var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod); var htmlEscape_exports = {}; __export(htmlEscape_exports, { htmlEscapeJsonString: () => htmlEscapeJsonString, safeJsonStringify: () => safeJsonStringify }); module.exports = __toCommonJS(htmlEscape_exports); 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)); }