Package: effect
Module: Array
Converts an Iterable to an Array.
When to use
Use to convert any Iterable (Set, Generator, etc.) into an array.
Details
If the input is already an array, this returns it by reference without
copying. Otherwise, it creates a new array from the iterable. Use copy if
you need a fresh array even when the input is already an array.
Example (Converting a Set to an array)
import { Array } from "effect"
const result = Array.fromIterable(new Set([1, 2, 3]))
console.log(result) // [1, 2, 3]
See
ensure — wrap a single value or return an existing arraycopy — create a shallow copy of an arraySignature
declare const fromIterable: <A>(collection: Iterable<A>) => Array<A>
Since v2.0.0