Function objEntriesArray

  • Returns an array of key-value pairs from the given object.

    Type Parameters

    • V

    Parameters

    • obj: Record<ObjectKey, V>

      The object to extract keyvalue pairs from.

    Returns [string, V][]

    An array of entries, where each entry is a tuple of a string and a value of type V.

    Remarks

    This function is a utility for converting an object into an array of its entries. Each entry is a tuple where the first element is the key and the second is the value.

    Typeparam

    V - The type of the values in the object.

    Example

    const obj = { a: 1, b: 2, c: 3 };
    objEntriesArray(obj);
    //=> [['a', 1], ['b', 2], ['c', 3]]

Generated using TypeDoc