nx.js
Classes

URLSearchParams

MDN Reference

Implements

Constructors

new URLSearchParams()

new URLSearchParams(init?): URLSearchParams

Parameters

ParameterType
init?string | URLSearchParams | Record<string, string> | string[][]

Returns

URLSearchParams

Properties

PropertyModifierTypeDescription
sizereadonlynumberMDN Reference

Methods

[iterator]()

[iterator](): IterableIterator<[string, string]>

Returns

IterableIterator<[string, string]>

Implementation of

globalThis.URLSearchParams.[iterator]


append()

append(name, value): void

Appends a specified key/value pair as a new search parameter.

MDN Reference

Parameters

ParameterType
namestring
valuestring

Returns

void

Implementation of

globalThis.URLSearchParams.append


delete()

delete(name, value?): void

Deletes the given search parameter, and its associated value, from the list of all search parameters.

MDN Reference

Parameters

ParameterType
namestring
value?string

Returns

void

Implementation of

globalThis.URLSearchParams.delete


entries()

entries(): IterableIterator<[string, string]>

Returns an array of key, value pairs for every entry in the search params.

Returns

IterableIterator<[string, string]>

Implementation of

globalThis.URLSearchParams.entries


forEach()

forEach(callbackfn, thisArg): void

Parameters

ParameterType
callbackfn(value, key, parent) => void
thisArgany

Returns

void

Implementation of

globalThis.URLSearchParams.forEach


get()

get(name): null | string

Returns the first value associated to the given search parameter.

MDN Reference

Parameters

ParameterType
namestring

Returns

null | string

Implementation of

globalThis.URLSearchParams.get


getAll()

getAll(name): string[]

Returns all the values association with a given search parameter.

MDN Reference

Parameters

ParameterType
namestring

Returns

string[]

Implementation of

globalThis.URLSearchParams.getAll


has()

has(name): boolean

Returns a Boolean indicating if such a search parameter exists.

MDN Reference

Parameters

ParameterType
namestring

Returns

boolean

Implementation of

globalThis.URLSearchParams.has


keys()

keys(): IterableIterator<string>

Returns a list of keys in the search params.

Returns

IterableIterator<string>

Implementation of

globalThis.URLSearchParams.keys


set()

set(name, value): void

Sets the value associated to a given search parameter to the given value. If there were several values, delete the others.

Parameters

ParameterType
namestring
valuestring

Returns

void

Implementation of

globalThis.URLSearchParams.set

See

https://developer.mozilla.org/docs/Web/API/URLSearchParams/set


sort()

sort(): void

Sorts all key/value pairs contained in this object in place and returns undefined. The sort order is according to unicode code points of the keys. This method uses a stable sorting algorithm (i.e. the relative order between key/value pairs with equal keys will be preserved).

Returns

void

Implementation of

globalThis.URLSearchParams.sort

See

https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort


toString()

toString(): string

Returns a string containing a query string suitable for use in a URL. Does not include the question mark.

Returns

string

Implementation of

globalThis.URLSearchParams.toString

Example

const params = new URLSearchParams({ foo: '1', bar: '2' });
 
// Add a second foo parameter.
params.append("foo", 4);
 
params.toString();
// Returns "foo=1&bar=2&foo=4"

See

https://developer.mozilla.org/docs/Web/API/URLSearchParams/toString


values()

values(): IterableIterator<string>

Returns a list of values in the search params.

Returns

IterableIterator<string>

Implementation of

globalThis.URLSearchParams.values

On this page