collect
import { collect } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/iterable.ts";Collect all values of an Iterable into an array.
⚠️ Warning: If the Iterable is infinite, this will cause the program to hang indefinitely.
@example
import * as I from "./iterable.ts";
const numbers = I.wrap(1, 2, 3, 4, 5);
const array = I.collect(numbers); // [1, 2, 3, 4, 5]
// Be careful with infinite iterables!
// const infinite = I.range(); // Infinite range
// const result = I.collect(infinite); // This will hang!
function collect<A>(ta: Iterable<A>): ReadonlyArray<A>;