Function queryStringToObject

  • Converts a query string to an object.

    Type Parameters

    • T extends string

      The type of the URL string.

    • U extends Record<PropertyKey, any> = QueryStringToObject<T>

      The type of the object to return.

    Parameters

    • url: T

      The URL string to convert.

    Returns U

    The object representation of the query string in url.

    Example

    `queryStringToObject('foo=1&bar=2&baz=3')`
    

    Example

    `queryStringToObject('foo=&bar=2&baz=3')`
    

    Example

    `queryStringToObject('foo[0]=1&foo[1]=2&baz=3')`