Skip to content

TypeScript API / @laikacms/server/oauth2 / jsonForInlineScript

Function: jsonForInlineScript() ​

ts
function jsonForInlineScript(value): string;

Serialize a value to JSON that is safe to embed inside an inline <script>. Escapes < so a </script> (or <!--) sequence inside the data cannot terminate the script element early, and U+2028/U+2029 which are line terminators in JavaScript source.

Parameters ​

ParameterType
valueunknown

Returns ​

string

Released under the MIT License.