🧩 Transforms each item using a mapper function.

Syntax

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

mapIter<T, U>(iter: Iterable<T>, fn: (val: T) => U): IterableIterator<U>

Parameters

  • iter: The source iterable.

  • fn: The mapper function.

Returns

A new iterable iterator.

Examples

TypeScript
[...mapIter([1, 2, 3], (x) => x * 2)] //=> [2, 4, 6]
Last updated on
Edit this page