Hyperlinkv0.8.0-beta.28

Array

Array.fromRecordconsteffect/Array.ts:366
<K extends string, A>(self: Readonly<Record<K, A>>): Array<[K, A]>

Converts a record into an array of [key, value] tuples.

When to use

Use to convert a record into an array of key-value tuples for iteration or transformation.

Details

Key order follows Object.entries semantics. Empty records produce an empty array.

Example (Converting a record to entries)

import { Array } from "effect"

const result = Array.fromRecord({ a: 1, b: 2, c: 3 })
console.log(result) // [["a", 1], ["b", 2], ["c", 3]]
Source effect/Array.ts:3661 lines
export const fromRecord: <K extends string, A>(self: Readonly<Record<K, A>>) => Array<[K, A]> = Record.toEntries