callbag-tap

1.3.0 • Public • Published

callbag-tap

Callbag operator that taps the source with the given function, but otherwise acts as a noop.

Therefore it is not the same as forEach which is a sink (that actively consumes sources).

npm install callbag-tap

You can tap data, error and completion respectively:

const tapped = tap(dataTapFunc, errorTapFunc, completionTapFunc)(source);

example

const fromIter = require('callbag-from-iter');
const tap = require('callbag-tap');
const forEach = require('callbag-for-each');
 
const source = fromIter([1,2,3]);
const tapped = tap(x => console.log("tap", x))(source);
const sink = forEach(x => console.log("sink", x))(tapped);
 
// tap 1
// sink 1
// tap 2
// sink 2
// tap 3
// sink 3

Readme

Keywords

Package Sidebar

Install

npm i callbag-tap

Weekly Downloads

55

Version

1.3.0

License

MIT

Unpacked Size

5.62 kB

Total Files

6

Last publish

Collaborators

  • krawaller