UrlCodec
Class
stable
A codec for encoding and decoding URL parts.
encodePath
stringEncodes the path from the provided string
@parampath
stringThe path string
@returns
stringdecodePath
stringDecodes the path from the provided string
@parampath
stringThe path string
@returns
stringencodeSearch
stringEncodes the search string from the provided string or object
@paramsearch
string | { [k: string]: unknown; }@returns
stringdecodeSearch
{ [k: string]: unknown; }Decodes the search objects from the provided string
@paramsearch
string@returns
{ [k: string]: unknown; }encodeHash
stringEncodes the hash from the provided string
@paramhash
string@returns
stringdecodeHash
stringDecodes the hash from the provided string
@paramhash
string@returns
stringnormalize
2 overloadsNormalizes the URL from the provided string
@paramhref
string@returns
stringNormalizes the URL from the provided string, search, hash, and base URL parameters
@parampath
stringThe URL path
@paramsearch
{ [k: string]: unknown; }The search object
@paramhash
stringThe has string
@parambaseUrl
string | undefinedThe base URL for the URL
@returns
stringareEqual
booleanChecks whether the two strings are equal
@paramvalA
stringFirst string for comparison
@paramvalB
stringSecond string for comparison
@returns
booleanparse
{ 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
stringThe full URL string
@parambase
string | undefinedThe base for the URL
@returns
{ href: string; protocol: string; host: string; search: string; hash: string; hostname: string; port: string; pathname: string; }Jump to details