Convert one value from an (async)iterator into another.
import map from 'it-map'// This can also be an iterator, generator, etcconst values = [0, 1, 2, 3, 4]const result = map(values, (val, index) => val++)console.info(result) // [1, 2, 3, 4, 5] Copy
import map from 'it-map'// This can also be an iterator, generator, etcconst values = [0, 1, 2, 3, 4]const result = map(values, (val, index) => val++)console.info(result) // [1, 2, 3, 4, 5]
Async sources and transforms must be awaited:
import map from 'it-map'const values = async function * () { yield * [0, 1, 2, 3, 4]}const result = await map(values(), async (val, index) => val++)console.info(result) // [1, 2, 3, 4, 5] Copy
import map from 'it-map'const values = async function * () { yield * [0, 1, 2, 3, 4]}const result = await map(values(), async (val, index) => val++)console.info(result) // [1, 2, 3, 4, 5]
Convert one value from an (async)iterator into another.
Example
Async sources and transforms must be awaited: