2.1.0 • Published 5 years ago

callbag-map-when v2.1.0

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

callbag-map-when

Callbag operator that applies a transformation function only to items that satisfy the predicate function. Works as filter() followed by map() on either pullable or listenable sources.

npm install callbag-map-when

Example

const mapWhen = require('callbag-map-when');
const forEach = require('callbag-for-each');
const fromIter = require('callbag-from-iter');
const pipe = require('callbag-pipe');

pipe(
  fromIter([1, 2, 3, 4]),
  mapWhen(n => n % 2 === 0, n => n * 10),
  forEach((n) => {
    console.log(n); // 20
  })                // 40
);
2.1.0

5 years ago

2.0.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago