hey there. Great library!
A takeWhile() operator would be great.
Something like this?
const takeWhile = (predicate, inclusive = false) => async function* (iterable){
for await (const res of iterable) {
if (!await predicate(res)){
if (inclusive){ yield res }
return
}
yield res
}
}
const count = [1, 2, 3, 4, 5, 6, 7]
await collect(takeWhile(x => x < 5)(count))
// => [1, 2, 3, 4]
hey there. Great library!
A
takeWhile()operator would be great.Something like this?