Url

nge. Url

new Url()

The URL.

Members

(nullable) fragment :string

The fragment.
Type:

(nullable) host :string

The host.
Type:

(nullable) path :string

The path.
Type:

(nullable) port :number

The port number.
Type:
  • number

(nullable) query :string

The query.
Type:

(nullable) scheme :string

The scheme.
Type:

Methods

(static) decodePath(path) → {string}

Returns decoded URL path.
Parameters:
Name Type Description
path string The path to decode.
Returns:
The URL decoded path.
Type
string

(static) encode(comp) → {string}

Returns URL encoded component.
Parameters:
Name Type Description
comp string The component to encode.
Returns:
The URL encoded component.
Type
string

(static) encodePath(path) → {string}

Returns URL encoded path.
Parameters:
Name Type Description
path string The path to encode.
Returns:
The URL encoded path.
Type
string

(static) param(url, param, …value) → {string}

Adds query parameter(s) to URL.
Parameters:
Name Type Attributes Description
url string The URL string.
param string | Object The parameter name or object of parameters.
value string <repeatable>
The parameter value, in case param is a string.
Returns:
The URL with added parameter(s).
Type
string

(static) parse(string) → {nge.Url}

Parses URL string. The returned URL contains encoded query string if present.
Parameters:
Name Type Description
string string The URL string.
Returns:
The URL.
Type
nge.Url

(static) parseQuery(string) → (nullable) {Object}

Parses URL query string.
Parameters:
Name Type Description
string string The query string.
Returns:
The query parameters or null if there is no query.
Type
Object