import { URLSearchParams } from "https://deno.land/x/deno@v0.28.0/cli/js/url_search_params.ts";
Properties
Methods
Appends a specified key/value pair as a new search parameter.
searchParams.append('name', 'first');
searchParams.append('name', 'second');
Deletes the given search parameter and its associated value, from the list of all search parameters.
searchParams.delete('name');
Returns an iterator allowing to go through all key/value pairs contained in this object.
for (const [key, value] of searchParams.entries()) {
console.log(key, value);
}
Calls a function for each element contained in this object in place and return undefined. Optionally accepts an object to use as this when executing callback as second argument.
searchParams.forEach((value, key, parent) => {
console.log(value, key, parent);
});
Returns the first value associated to the given search parameter.
searchParams.get('name');
Returns all the values associated with a given search parameter as an array.
searchParams.getAll('name');
Returns a Boolean that indicates whether a parameter with the specified name exists.
searchParams.has('name');
Returns an iterator allowing to go through all keys contained in this object.
for (const key of searchParams.keys()) {
console.log(key);
}
Sets the value associated with a given search parameter to the given value. If there were several matching values, this method deletes the others. If the search parameter doesn't exist, this method creates it.
searchParams.set('name', 'value');
Sort all key/value pairs contained in this object in place and return undefined. The sort order is according to Unicode code points of the keys.
searchParams.sort();
Returns a query string suitable for use in a URL.
searchParams.toString();
Returns an iterator allowing to go through all values contained in this object.
for (const value of searchParams.values()) {
console.log(value);
}
Returns an iterator allowing to go through all key/value pairs contained in this object.
for (const [key, value] of searchParams[Symbol.iterator]()) {
console.log(key, value);
}