yarn add callbag-flatten-iter
const pipe = require("callbag-pipe");
const fromIter = require("callbag-from-iter");
const flattenIter = require("callbag-flatten-iter");
const forEach = require("callbag-for-each");
pipe(
fromIter([[10], [20], [30], [40, 50, 60]]),
flattenIter,
forEach(i => {
// called 6 times
})
);
If you're blessed with the pipeline operator:
fromIter([[10], [20], [30], [40, 50, 60]])
|> flattenIter
|> forEach(i => {
// called 6 times
});
- Callbag basics
- Why we need callbags, by André Staltz