utils/escape
Documentation
- source: utils/escape.ts
Overview
Classes
Escape
escapeCsv()
Escapes special characters in a string to make it safe for use as a value within a CSV file. Typically handles double quotes, commas, and newlines.
tsstatic escapeCsv(input: string): string;
Parameter Type Description inputstringThe string to be escaped. Returns
- Type:
string- Description: The CSV-safe escaped string.
escapeJavascript()
Escapes characters in a string to create a valid JavaScript string literal. This makes it safe for embedding string values within JavaScript code blocks.
tsstatic escapeJavascript(input: string): string;
Parameter Type Description inputstringThe string to be escaped. Returns
- Type:
string- Description: The JavaScript-safe escaped string.
escapeHtml3()
Escapes characters in a string using HTML 3.2 entity references.
tsstatic escapeHtml3(input: string): string;
Parameter Type Description inputstringThe string to be escaped. Returns
- Type:
string- Description: The HTML 3.2 escaped string.
escapeHtml4()
Escapes characters in a string using HTML 4.0 entity references. This is the common standard for escaping characters like <, >, &, and ".
tsstatic escapeHtml4(input: string): string;
Parameter Type Description inputstringThe string to be escaped. Returns
- Type:
string- Description: The HTML 4.0 escaped string.
escapeJava()
Escapes characters in a string to create a valid Java string literal.
tsstatic escapeJava(input: string): string;
Parameter Type Description inputstringThe string to be escaped. Returns
- Type:
string- Description: The Java-safe escaped string.
escapeJson()
Escapes characters (like quotes, backslashes, and control characters) in a string to make it safe for embedding as a value within a JSON document.
tsstatic escapeJson(input: string): string;
Parameter Type Description inputstringThe string to be escaped. Returns
- Type:
string- Description: The JSON-safe escaped string.
escapeXml()
Escapes characters in a string to make it valid for use within an XML document. Typically handles characters like <, >, &, ", and '.
tsstatic escapeXml(input: string): string;
Parameter Type Description inputstringThe string to be escaped. Returns
- Type:
string- Description: The XML-safe escaped string.
unescapeCsv()
The inverse of `escapeCsv`: unescapes CSV-specific escape sequences back to their original form.
tsstatic unescapeCsv(input: string): string;
Parameter Type Description inputstringThe CSV-escaped string. Returns
- Type:
string- Description: The unescaped string.
unescapeJavascript()
The inverse of `escapeJavascript`: unescapes JavaScript string literals.
tsstatic unescapeJavascript(input: string): string;
Parameter Type Description inputstringThe JavaScript-escaped string. Returns
- Type:
string- Description: The unescaped string.
unescapeHtml3()
The inverse of `escapeHtml3`: unescapes HTML 3.2 entity references.
tsstatic unescapeHtml3(input: string): string;
Parameter Type Description inputstringThe HTML 3.2 escaped string. Returns
- Type:
string- Description: The unescaped string.
unescapeHtml4()
The inverse of `escapeHtml4`: unescapes HTML 4.0 entity references.
tsstatic unescapeHtml4(input: string): string;
Parameter Type Description inputstringThe HTML 4.0 escaped string. Returns
- Type:
string- Description: The unescaped string.
unescapeJava()
The inverse of `escapeJava`: unescapes Java string literals.
tsstatic unescapeJava(input: string): string;
Parameter Type Description inputstringThe Java-escaped string. Returns
- Type:
string- Description: The unescaped string.
unescapeJson()
The inverse of `escapeJson`: unescapes JSON string escape sequences.
tsstatic unescapeJson(input: string): string;
Parameter Type Description inputstringThe JSON-escaped string. Returns
- Type:
string- Description: The unescaped string.
unescapeXml()
The inverse of `escapeXml`: unescapes XML entity references.
tsstatic unescapeXml(input: string): string;
Parameter Type Description inputstringThe XML-escaped string. Returns
- Type:
string- Description: The unescaped string.
