// Take care with < (which has special meaning inside script tags) // See: https://github.com/sveltejs/kit/blob/ff9a27b4/packages/kit/src/runtime/server/page/serialize_data.js#L4-L28 const replacements = { '<': '\\u003C', '\u2028': '\\u2028', '\u2029': '\\u2029', }; const pattern = new RegExp(`[${Object.keys(replacements).join('')}]`, 'g'); /** * Serializes a POJO into a HTML