Read passing data without changing it:
1linkfunction tap<T>(do: (t: T) => void): (src: Source<T>) => Source<T>
1linkimport { tap, interval, map, subscribe, pipe, filter } from 'callbag-common';
2link
3linkpipe(
4link interval(1000),
5link tap(v => console.log('Before: ' + v)),
6link map(x => x * 3),
7link filter(x => x % 2 === 0),
8link subscribe(v => console.log('After: ' + v))
9link)
10link
Before: 0
After: 0
Before: 1
Before: 2
After: 6
Before: 3
Before: 4
After: 12
...
👉 tap()
is useful for debugging as well as side-effects.