takeUntil operator for basic-streams
npm install @basic-streams/take-until``typescript`
takeUntil
Creates a stream containing values from the given stream that are producedcontroller
before the first event in the stream.
`js
import ofMany from "@basic-streams/of-many"
import later from "@basic-streams/later"
import takeUntil from "@basic-streams/take-until"
const stream = ofMany([1, 2, 3], 5000)
const controller = later(12000, 0)
const result = takeUntil(controller, stream)
result(x => {
console.log(x)
})
// > 1
// > 2
// stream: ____1____2_!
// controller: ___________0!
// result: ____1____2
``