Class: Uri

Uri

A class for parsing and manipulating URIs.

Constructor

new Uri()

Source:

Members

hash

Get the hash portion of the Uri.
Source:

hostname

Set the hostname for the Uri.
Source:

hostname

Get the hostname portion of the Uri.
Source:

origin

Get the origin portion of the Uri.
Source:

path

Get the path portion of the Uri.
Source:

protocol

Set the protocol for the Uri.
Source:

protocol

Get the protocol portion of the Uri.
Source:
Get the search portion of the Uri detailing the query parameters as a string.
Source:

Methods

addQueryParam(key, value)

Additively sets a query string parameter. It is possible to add multiple query parameter values with the same key using this function.
Parameters:
Name Type Description
key String The key of the query parameter to add.
value String | Number | Boolean The value of the added query parameter.
Source:

addQueryParams(queryMap)

Add a batch of query parameters.
Parameters:
Name Type Description
queryMap Object A list of key-value pairs to add as query parameters. It is possible to add multiple query parameter values with the same key using this function.
Source:

addSegments(…segments)

Add path segments to the Uri.
Parameters:
Name Type Attributes Description
segments String <repeatable>
The segments to be added to the Uri.
Source:

getQueryParam(key) → {String}

Get a query parameter value.
Parameters:
Name Type Description
key String The key of the query string value to fetch.
Source:
Returns:
The value of the query parameter.
Type
String

removeQueryParam(key)

Remove a query string parameter from the Uri.
Parameters:
Name Type Description
key String The key of the query parameter to remove.
Source:

setQueryParam(key, value)

Set the value of an existing query parameter, or add it if it does not exist.
Parameters:
Name Type Description
key String The key of the query parameter to add.
value String | Number | Boolean The value of the added query parameter.
Source:

setQueryParams(queryMap)

Set a batch of query parameters.
Parameters:
Name Type Description
queryMap Object A list of key-value pairs to set as query parameters. If any of the keys of this input object conflict with existing query parameter keys, they will be replaced.
Source:

toString() → {String}

Get a string representation of the current state of the Uri.
Source:
Returns:
The Uri string.
Type
String

Uri

new Uri(urlopt)

Construct a Uri from a supplied string.
Parameters:
Name Type Attributes Description
url String <optional>
The URI string to parse. If not supplied, an empty URI will be initialized.
Source:

Members

hash

Get the hash portion of the Uri.
Source:

hostname

Set the hostname for the Uri.
Source:

hostname

Get the hostname portion of the Uri.
Source:

origin

Get the origin portion of the Uri.
Source:

path

Get the path portion of the Uri.
Source:

protocol

Set the protocol for the Uri.
Source:

protocol

Get the protocol portion of the Uri.
Source:
Get the search portion of the Uri detailing the query parameters as a string.
Source:

Methods

addQueryParam(key, value)

Additively sets a query string parameter. It is possible to add multiple query parameter values with the same key using this function.
Parameters:
Name Type Description
key String The key of the query parameter to add.
value String | Number | Boolean The value of the added query parameter.
Source:

addQueryParams(queryMap)

Add a batch of query parameters.
Parameters:
Name Type Description
queryMap Object A list of key-value pairs to add as query parameters. It is possible to add multiple query parameter values with the same key using this function.
Source:

addSegments(…segments)

Add path segments to the Uri.
Parameters:
Name Type Attributes Description
segments String <repeatable>
The segments to be added to the Uri.
Source:

getQueryParam(key) → {String}

Get a query parameter value.
Parameters:
Name Type Description
key String The key of the query string value to fetch.
Source:
Returns:
The value of the query parameter.
Type
String

removeQueryParam(key)

Remove a query string parameter from the Uri.
Parameters:
Name Type Description
key String The key of the query parameter to remove.
Source:

setQueryParam(key, value)

Set the value of an existing query parameter, or add it if it does not exist.
Parameters:
Name Type Description
key String The key of the query parameter to add.
value String | Number | Boolean The value of the added query parameter.
Source:

setQueryParams(queryMap)

Set a batch of query parameters.
Parameters:
Name Type Description
queryMap Object A list of key-value pairs to set as query parameters. If any of the keys of this input object conflict with existing query parameter keys, they will be replaced.
Source:

toString() → {String}

Get a string representation of the current state of the Uri.
Source:
Returns:
The Uri string.
Type
String