Map each item into an iterator and flatten.
import { pipe } from "yta";import { flatMap, toArray } from "yta/async";import { range } from "yta/sync";await pipe( of(0, 1, 2, 3), flatMap((n) => of(...range(n))), toArray(),);// => [0, 0, 1, 0, 1, 2] Copy
import { pipe } from "yta";import { flatMap, toArray } from "yta/async";import { range } from "yta/sync";await pipe( of(0, 1, 2, 3), flatMap((n) => of(...range(n))), toArray(),);// => [0, 0, 1, 0, 1, 2]
See also:
The input type
The output type
The mapping function
Map each item into an iterator and flatten.
See also: