Class URLSearchParams

Hierarchy

  • URLSearchParams

Implements

Constructors

Properties

size: number

Methods

  • Returns IterableIterator<[string, string]>

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

    MDN Reference

    Parameters

    • name: string
    • value: string

    Returns void

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

    MDN Reference

    Parameters

    • name: string
    • Optional value: string

    Returns void

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

    Returns IterableIterator<[string, string]>

  • Parameters

    • callbackfn: ((value, key, parent) => void)
        • (value, key, parent): void
        • Parameters

          Returns void

    • thisArg: any = ...

    Returns void

  • Returns the first value associated to the given search parameter.

    MDN Reference

    Parameters

    • name: string

    Returns null | string

  • Returns all the values association with a given search parameter.

    MDN Reference

    Parameters

    • name: string

    Returns string[]

  • Returns a Boolean indicating if such a search parameter exists.

    MDN Reference

    Parameters

    • name: string

    Returns boolean

  • Returns a list of keys in the search params.

    Returns IterableIterator<string>

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

    Parameters

    • name: string
    • value: string

    Returns 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

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

    Returns string

    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

  • Returns a list of values in the search params.

    Returns IterableIterator<string>

Generated using TypeDoc