Skip to content

map

const map: <T, U>(fn: (x: T) => U, iterable: Iterable<T>) => Iterable<U> = builtins.map

Defined in: packages/pythonlib/src/index.ts:155

Apply a function to every item of the iterable and yield the results.

Uses ES2024 Iterator.prototype.map() for lazy evaluation.

Type Parameters

Type Parameter
T
U

Parameters

ParameterTypeDescription
fn(x: T) => UThe function to apply to each element
iterableIterable<T>The input iterable

Returns

Iterable<U>

An iterable of transformed values

See

Python map()