1.1.2 • Published 6 years ago

callbag-first v1.1.2

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

callbag-first

Callbag operator that emit the first value emitted from source on completion, based on provided expression.

npm install callbag-first

first(predicate?: (v: any) => Boolean, resultSelector?: (v: any) => any)

const {
  forEach,
  interval,
  pipe,
  fromIter
} = require('callbag-basics');

const first = require('callbag-first');

pipe(
  fromIter([1, 2, 3, 4]),
  first(),
  forEach(v => console.log(v)) // 1
);

pipe(
  fromIter([1, 2, 3, 4]),
  first(v => v > 3),
  forEach(v => console.log(v)) // 4
);

pipe(
  fromIter([1, 2, 3, 4]),
  first(v => v > 3, v => `value: ${v}`),
  forEach(v => console.log(v)) // value: 4
);
1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago