Creates an object from an array of key-value pairs (entries).

Type signature

<T>(entries: [string, T][]) => Result<T>

Examples

fromEntries([
  ["a", 1],
  ["b", 2],
  ["c", 3],
]);
// ⇒ { a: 1, b: 2, c: 3 }
Try in REPL

Questions

  • How to create an object from an array of key-value pairs?
  • How to create an object from an array of entries?

TypeScript sourceJavaScript source