Skip to content

fromEntries

fromEntries<T>(entries): { [K in T[number] as K[0]]: K[1] }

Returns an object created by key-value entries for properties and methods.

Example

fromEntries([["foo", "bar"]])
// => {foo: "bar"}
fromEntries([])
// => {}

Alternatives

Type Parameters

T extends readonly readonly [PropertyKey, unknown][]

Parameters

entries

T

Returns

{ [K in T[number] as K[0]]: K[1] }

The constructed object.