URLSearchParams
Implements
Constructors
new URLSearchParams()
new URLSearchParams(init
?): URLSearchParams
Parameters
Parameter | Type |
---|---|
init ? | string | URLSearchParams | Record <string , string > | string [][] |
Returns
Properties
Property | Modifier | Type | Description |
---|---|---|---|
size | readonly | number | MDN Reference |
Methods
[iterator]()
[iterator](): URLSearchParamsIterator
<[string
, string
]>
Returns
URLSearchParamsIterator
<[string
, string
]>
Implementation of
globalThis.URLSearchParams.[iterator]
append()
append(name
, value
): void
Appends a specified key/value pair as a new search parameter.
Parameters
Parameter | Type |
---|---|
name | string |
value | string |
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.
Parameters
Parameter | Type |
---|---|
name | string |
value ? | string |
Returns
void
Implementation of
globalThis.URLSearchParams.delete
entries()
entries(): URLSearchParamsIterator
<[string
, string
]>
Returns an array of key, value pairs for every entry in the search params.
Returns
URLSearchParamsIterator
<[string
, string
]>
Implementation of
globalThis.URLSearchParams.entries
forEach()
forEach(callbackfn
, thisArg
): void
Parameters
Parameter | Type |
---|---|
callbackfn | (value , key , parent ) => void |
thisArg | any |
Returns
void
Implementation of
globalThis.URLSearchParams.forEach
get()
get(name
): null
| string
Returns the first value associated to the given search parameter.
Parameters
Parameter | Type |
---|---|
name | string |
Returns
null
| string
Implementation of
globalThis.URLSearchParams.get
getAll()
getAll(name
): string
[]
Returns all the values association with a given search parameter.
Parameters
Parameter | Type |
---|---|
name | string |
Returns
string
[]
Implementation of
globalThis.URLSearchParams.getAll
has()
has(name
): boolean
Returns a Boolean indicating if such a search parameter exists.
Parameters
Parameter | Type |
---|---|
name | string |
Returns
boolean
Implementation of
globalThis.URLSearchParams.has
keys()
keys(): URLSearchParamsIterator
<string
>
Returns a list of keys in the search params.
Returns
URLSearchParamsIterator
<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
Parameter | Type |
---|---|
name | string |
value | string |
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
See
https://developer.mozilla.org/docs/Web/API/URLSearchParams/toString
values()
values(): URLSearchParamsIterator
<string
>
Returns a list of values in the search params.
Returns
URLSearchParamsIterator
<string
>
Implementation of
globalThis.URLSearchParams.values