Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/Andarist/callbag-drop-after

👜 Callbag operator that drops all events after the first event for which predicate returns true.
https://github.com/Andarist/callbag-drop-after

callbag callbags

Last synced: about 2 months ago
JSON representation

👜 Callbag operator that drops all events after the first event for which predicate returns true.

Awesome Lists containing this project

README

        

# callbag-drop-after

Callbag operator that drops all events after the first event for which predicate returns `true`.

Inspired by [most.js's skipAfter](https://mostcore.readthedocs.io/en/latest/api.html#skipafter).

## Example

```js
import dropAfter from 'callbag-drop-after'
import forEach from 'callbag-for-each'
import fromIter from 'callbag-from-iter'
import pipe from 'callbag-pipe'

pipe(
fromIter([10, 20, 30, 40, 50, 60, 70]),
dropAfter(value => value >= 30),
forEach(value => {
// will log 10, 20, 30
console.log(value)
}),
)
```