Function fromEntries

Converts an array of [key, value] pairs to an object. Curried wrapper around Object.fromEntries for composition.

fromEntries([['a', 1], ['b', 2], ['c', 3]]);
// => { a: 1, b: 2, c: 3 }
  • Type Parameters

    • T = unknown

      Value type

    Parameters

    • entries: readonly (readonly [string, T])[]

      Array of [key, value] pairs

    Returns Record<string, T>

    Object created from entries