VDL Plugin SDK

escapeScriptTag

Import from @varavel/vdl-plugin-sdk/utils/strings.

function escapeScriptTag(str): string;

Escapes sequences that could prematurely close an HTML <script> tag. Use this when injecting JSON data or raw strings into embedded scripts.

Parameters

ParameterTypeDescription
strstringThe string to escape.

Returns

string

The escaped string safe for embedding in a script tag.