Function parseQueryString

  • Parses a query string into an object of key-value pairs.

    Parameters

    • queryString: string

      The query string to parse. It may include a leading '?' which will be removed automatically.

    Returns Record<string, string | string[]>

    An object where keys are query parameter names and values are either a string or an array of strings if the parameter appears multiple times.

    Example

    const queryString = '?foo=bar&baz=qux&foo=baz';
    const result = parseQueryString(queryString);
    console.log(result);
    // Output: { foo: ['bar', 'baz'], baz: 'qux' }

Generated using TypeDoc