URLQuery class
A class that handles the query portion of a URLBuilder.
Methods
any() | Get whether or not there any query parameters in this URLQuery. |
get(string) | Get the value of the query parameter with the provided name. If no parameter exists with the provided parameter name, then undefined will be returned. |
keys() | Get the keys of the query string. |
parse(string) | Parse a URLQuery from the provided text. |
set(string, unknown) | Set a query parameter with the provided name and value. If the parameterValue is undefined or empty, then this will attempt to remove an existing query parameter with the provided parameterName. |
to |
Get the string representation of this query. The return value will not start with a "?". |
Method Details
any()
Get whether or not there any query parameters in this URLQuery.
function any(): boolean
Returns
boolean
get(string)
Get the value of the query parameter with the provided name. If no parameter exists with the provided parameter name, then undefined will be returned.
function get(parameterName: string): undefined | string | string[]
Parameters
- parameterName
-
string
Returns
undefined | string | string[]
keys()
Get the keys of the query string.
function keys(): string[]
Returns
string[]
parse(string)
Parse a URLQuery from the provided text.
static function parse(text: string): URLQuery
Parameters
- text
-
string
Returns
set(string, unknown)
Set a query parameter with the provided name and value. If the parameterValue is undefined or empty, then this will attempt to remove an existing query parameter with the provided parameterName.
function set(parameterName: string, parameterValue: unknown)
Parameters
- parameterName
-
string
- parameterValue
-
unknown
toString()
Get the string representation of this query. The return value will not start with a "?".
function toString(): string
Returns
string