🧩 Executes a function for each item in an iterator.

Syntax

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

eachIter<T>(iter: Iterable<T>, fn: (val: T) => void): void

Parameters

  • iter: The iterable to iterate over.

  • fn: The function to execute for each item.

Returns

None. Iteration happens immediately.

Examples

TypeScript
eachIter([1, 2, 3], x => console.log(x)) //=> Logs 1, 2, 3
Last updated on
Edit this page