• Parses a query string into an object of key value pairs. Reoccurring keys are converted into key-array pairs. No transformation of the individual values is done, i.e. all values will be strings.

    Parameters

    • query: string | URLSearchParams

      The query string. May start with an optional "?"

    Returns Record<string, string | string[]>

    the parsed object

    import { queryToObject } from "apprt-core/url-utils";
    const object = queryToObject("a=1&b=2&b=3");
    // object is { a: "1", b: ["2", "3"] }