utils/url
Documentation
- source: utils/url.ts
Overview
Classes
URL
encode()
URL-encodes the input string, typically used for encoding query parameter values.
tsstatic encode(input: string, charset: string): string;
Parameter Type Description inputstringThe string to be encoded. charsetstringThe character set (e.g., 'UTF-8', 'ISO-8859-1') to use for encoding. Defaults to the system's preferred encoding if omitted. Returns
- Type:
string- Description: The URL-encoded string.
decode()
URL-decodes the input string, typically used for decoding query parameter values.
tsstatic decode(input: string, charset: string): string;
Parameter Type Description inputstringThe string to be decoded. charsetstringThe character set (e.g., 'UTF-8', 'ISO-8859-1') that was used for encoding. Defaults to the system's preferred encoding if omitted. Returns
- Type:
string- Description: The URL-decoded string.
escape()
Escapes the input string using general URL escaping rules. This is typically equivalent to `encodeURIComponent` and is suitable for encoding query parameter values.
tsstatic escape(input: string): string;
Parameter Type Description inputstringThe string to escape. Returns
- Type:
string- Description: The escaped string.
escapePath()
Escapes the input string specifically for use as a URL path segment. It typically preserves path delimiters like `/` that might otherwise be escaped in standard URL encoding.
tsstatic escapePath(input: string): string;
Parameter Type Description inputstringThe path string to escape. Returns
- Type:
string- Description: The escaped path string.
escapeForm()
Escapes the input string according to the rules for HTML Form Data (application/x-www-form-urlencoded). This typically replaces spaces with `+` instead of `%20`.
tsstatic escapeForm(input: string): string;
Parameter Type Description inputstringThe form data string to escape. Returns
- Type:
string- Description: The escaped form data string.
