consume
with which to capture any kind of custom state and/or logic handling on a case-by-case basis, so adding things like this probably won’t be useful to most people
h([1, 2, 3, 4])
.through(stream => {
const evens = stream.fork()
.filter(x => x % 2 === 0)
const odds = stream.fork()
.filter(x => x % 2 !== 0)
.flatMap(saveToDb)
.reject(() => true)
return h([evens, odds])
.merge()
})
.each(h.log) // 1 3
async function f() {
let res = await fetch(‘https://example.com);
while(res.code !== 404) {
res = await fetch(‘https://example.com);
}
}
_(f())
inside flatMap