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

    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

    • Optional 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.

    MDN Reference

    Parameters

    • name: string
    • value: string

    Returns void

  • 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"
  • Returns a list of values in the search params.

    Returns IterableIterator<string>

Generated using TypeDoc