GeoParams

GeoParams

Geo URI Parameters as defined in RFC 5870

Intended to be similar to URLSearchParams, with an associated URL object.

The following methods of URLSearchParams are not implemented in GeoParams because they only make sense for repeated parameters:

  • append
  • getAll

crs and u parameters can't be repeated according to the URI Scheme Syntax. It's not so clear about other parameters because RFC 5870 talks about sets of parameters and parameter names in the URI Comparison section. GeoParams assumes that parameters can't be repeated. Practically it doesn't matter much because the only commonly used parameter should be u.

Constructor

new GeoParams(optionsopt)

Description:
  • Create a new GeoParams object

    options is one of:

    • undefined to construct empty geo parameters
    • string to construct geo parameters according to geo URI parameters syntax, which is a p rule in URI Scheme Syntax except without the leading ; separator
    • array of name-value string pairs
    • record of string keys and string values
Source:
See:
  • MDN for the similar URLSearchParams constructor
Parameters:
Name Type Attributes Description
options string | Array.<Array.<string>> | Object.<string, string> <optional>

Classes

GeoParams

Members

(readonly) size :number

Description:
  • Total number of parameter entries

Source:
See:
  • MDN for the similar property of URLSearchParams

Total number of parameter entries

Type:
  • number

Methods

delete(name, valueopt) → {void}

Description:
  • Delete the specified parameter

    Delete a parameter with the given name. If value is specified, delete only if the parameter has this value.

Source:
See:
  • MDN for the similar method of URLSearchParams
Parameters:
Name Type Attributes Description
name string
value string <optional>

optional value to check

Returns:
Type
void

(generator) entries() → {Iterable.<Array.<string>>}

Description:
  • Get an iterable for all name-value pairs of parameters

    Same as iterating through a geo params object directly.

Source:
See:
  • MDN for the similar method of URLSearchParams
Returns:
Type
Iterable.<Array.<string>>

forEach(callback, thisArgopt)

Description:
  • Iterate through all parameters via a callback function

Source:
See:
  • MDN for the similar method of URLSearchParams
Parameters:
Name Type Attributes Description
callback forEachCallback

function to execute on each element

thisArg * <optional>

value to use as this when executing callback

get(name) → {string|null}

Description:
  • Get the value associated to the given parameter

Source:
See:
  • MDN for the similar method of URLSearchParams
Parameters:
Name Type Description
name string
Returns:
  • parameter value or null for a missing parameter
Type
string | null

has(name, valueopt) → {boolean}

Description:
  • Indicate whether the specified parameter is present

    Check if a parameter with the given name is present. If value is specified, also check if the parameter has this value.

Source:
See:
  • MDN for the similar method of URLSearchParams
Parameters:
Name Type Attributes Description
name string
value string <optional>

optional value to check

Returns:
Type
boolean

(generator) keys() → {Iterable.<string>}

Description:
  • Get an iterable for all names of parameters

Source:
See:
  • MDN for the similar method of URLSearchParams
Returns:
Type
Iterable.<string>

set(name, value) → {void}

Description:
  • Set the value associated with a given parameter to the given value

Source:
See:
  • MDN for the similar method of URLSearchParams
Parameters:
Name Type Description
name string
value string
Returns:
Type
void

toString() → {string}

Description:
  • Convert the parameters to a string

    The string is a semicolon-separated list of geo parameters. This is the part of RFC 5870 geo URI that comes after the coordinates. The ; that separates the coordinates and the parameters is not included in the string.

    Each geo parameter is represented by:

    • name=value
    • name without both value and = if the value is an empty string (a "flag" type parameter discussed in the parameter registry section of RFC 5870)
Source:
See:
  • MDN for the similar method of URLSearchParams
Returns:
Type
string

(generator) values() → {Iterable.<string>}

Description:
  • Get an iterable for all values of parameters

Source:
See:
  • MDN for the similar method of URLSearchParams
Returns:
Type
Iterable.<string>