UrlCodec
Class
A codec for encoding and decoding URL parts.
API
abstract class UrlCodec {}
encodePath
string
Encodes the path from the provided string
@parampath
string
The path string
@returns
string
decodePath
string
Decodes the path from the provided string
@parampath
string
The path string
@returns
string
encodeSearch
string
Encodes the search string from the provided string or object
@paramsearch
string | { [k: string]: unknown; }
@returns
string
decodeSearch
{ [k: string]: unknown; }
Decodes the search objects from the provided string
@paramsearch
string
@returns
{ [k: string]: unknown; }
encodeHash
string
Encodes the hash from the provided string
@paramhash
string
@returns
string
decodeHash
string
Decodes the hash from the provided string
@paramhash
string
@returns
string
normalize
2 overloads
Normalizes the URL from the provided string
@paramhref
string
@returns
string
Normalizes the URL from the provided string, search, hash, and base URL parameters
@parampath
string
The URL path
@paramsearch
{ [k: string]: unknown; }
The search object
@paramhash
string
The has string
@parambaseUrl
string | undefined
The base URL for the URL
@returns
string
areEqual
boolean
Checks whether the two strings are equal
@paramvalA
string
First string for comparison
@paramvalB
string
Second string for comparison
@returns
boolean
parse
{ href: string; protocol: string; host: string; search: string; hash: string; hostname: string; port: string; pathname: string; }
Parses the URL string based on the base URL
@paramurl
string
The full URL string
@parambase
string | undefined
The base for the URL
@returns
{ href: string; protocol: string; host: string; search: string; hash: string; hostname: string; port: string; pathname: string; }
Jump to details