takeWhile operator for basic-streams
npm install @basic-streams/take-while``typescript`
takeWhile
Creates a stream containing each value from the given stream up until thex
first value for which predicate(x) returns false.
`js
import ofMany from "@basic-streams/of-many"
import takeWhile from "@basic-streams/take-while"
const stream = ofMany([0, 1, 2, 1], 5000)
const result = takeWhile(x => x < 2, stream)
result(x => {
console.log(x)
})
// > 0
// > 1
// stream: ____0____1____2!
// result: ____0____1
``