Function: queryStringToObject()

queryStringToObject<T, U>(url): U

Converts a query string to an object.

Type Parameters

T

T extends string

The type of the URL string.

U

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.

Examples

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