🧩 Collects all items from an iterator into an array.

Syntax

TypeScript
import { toArrayIter } from '@opentf/std';

toArrayIter<T>(iter: Iterable<T>): T[]

Parameters

  • iter: The source iterable.

Returns

An array of all items.

Examples

TypeScript
toArrayIter((function*() { yield 1; yield 2; })()) //=> [1, 2]
Last updated on
Edit this page