Function flatten

  • Flatten the parameters object into a single level object that can be used as query parameters.

    For example, the following object:

    {
    "a": 1,
    "b": {
    "c": 2,
    "d": [3, 4]
    }
    }

    Will be flattened into:

    {
    "a": "1",
    "b[c]": "2",
    "b[d][0]": "3",
    "b[d][1]": "4"
    }

    Parameters

    • obj: unknown
    • prefix: string = ""
    • result: Record<string, string> = {}
    • visited: Set<unknown> = ...

    Returns Record<string, string>

Generated using TypeDoc