callbag-take-to-finally

0.2.0 • Public • Published

callbag-take-while

Callbag operator which emits values emitted by the source as long as each value satisfies the given predicate, and then completes as soon as predicate is not satisfied. Call lastly function when callbag is over. This operator forked from: Andarist: takeWhile

Example

import forEach from 'callbag-for-each'
import fromIter from 'callbag-from-iter'
import pipe from 'callbag-pipe'
import takeToFinally from 'callbag-take-to-finally'
 
pipe(
  fromIter([1, 2, 3, 4, 5, 6, 7]),
  takeToFinally(
    data => data < 4.3,
    data => console.log(`failed on test: ${data}`),
  ),
  forEach(console.log),
)
 
// log: 1, 2, 3, 4, "failed on test: 5"

Readme

Keywords

Package Sidebar

Install

npm i callbag-take-to-finally

Weekly Downloads

0

Version

0.2.0

License

MIT

Unpacked Size

3.54 kB

Total Files

5

Last publish

Collaborators

  • pengeszikra