Maps an input sync iterable using a provided map function. Returns a new synchronous iterable.
A function that accepts an input sync iterable and returns a new synchronous iterable.
const input = [1, 2, 3];const double = (x: number) => x * 2;const mappedSyncIterable = mapSync(double)(input);for (const x of mappedSyncIterable) { console.log(x); // Logs 2, 4, 6}
Available as map when imported from peter-piper/sync.
map
peter-piper/sync
The type of elements in the input sync iterable.
The type of elements in the output iterable.
A function that takes a value and its index and returns a new value.
Generated using TypeDoc
Maps an input sync iterable using a provided map function. Returns a new synchronous iterable.
Returns
A function that accepts an input sync iterable and returns a new synchronous iterable.
Example
Remarks
Available as
map
when imported frompeter-piper/sync
.