Optionalinit: string | Record<string, string> | URLSearchParams | string[][]
The initial pairs: a query string (an initial ?, if
present, is ignored), an array of [name, value] pairs, an object of
names to values, or another URLSearchParams to copy. Omit for an
empty list.
Same as entries: iterating the object itself yields [name, value] pairs.
Adds a pair to the end of the list, keeping any existing pairs with the same name.
Removes all pairs with the given name.
Iterates over the pairs as [name, value] arrays.
Calls a function once for each pair, in order.
Returns the value of the first pair with the given name, or null if there is none.
Returns the values of all pairs with the given name, in order.
Returns whether at least one pair with the given name exists.
Iterates over the names, in pair order. A repeated name appears once per pair.
Sets the value of the first pair with the given name and removes any others — or appends the pair if the name is not present.
Sorts the pairs by name, keeping the relative order of pairs with the same name.
Serializes the pairs as a query string in application/x-www-form-urlencoded form (spaces become +), without a leading ?.
Iterates over the values, in pair order.
An ordered list of name–value pairs, representing a parsed URL query string. This is the standard Web API
URLSearchParamsclass: MDN documents it in further depth, though only the members declared here are guaranteed to be present.Obtain one from a URL's
searchParamsproperty, or construct one standalone. Names and values are stored in decoded form; percent-decoding happens on parsing and encoding on serialization. The same name may appear in more than one pair: append adds a pair unconditionally while set replaces, and get returns the first value while getAll returns all of them.Note that toString serializes in
application/x-www-form-urlencodedform, which encodes spaces as+rather than%20. See PopClip.openUrl for how PopClip compensates for this.Example