Function flatten

  • Takes an optionally nested textobject structure and convert to a flat structure. Nested keys are joined with a dot ".". Deep nesting is supported.

    Given the following:

    {
    "foo": {
    "bar": "text"
    }
    }

    It would produce the following output:

    {
    "foo.bar": "text"
    }

    If the src object is already flat the output will be the same.

    Parameters

    • src: NestedStringRecord

      Source data

    • Optionaldestination: Record<string, string>

      Destination to write temporary result to.

    • prefix: string = ""

      If set this is prefixed to all keys.

    Returns Record<string, string>