https://github.com/willisplummer/callbag-trace
Callbag operator that logs values to the console midstream for simpler debugging
https://github.com/willisplummer/callbag-trace
callbag callbags
Last synced: 7 months ago
JSON representation
Callbag operator that logs values to the console midstream for simpler debugging
- Host: GitHub
- URL: https://github.com/willisplummer/callbag-trace
- Owner: willisplummer
- Created: 2018-04-25T03:05:00.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-25T03:50:29.000Z (over 7 years ago)
- Last Synced: 2025-02-22T07:20:07.098Z (8 months ago)
- Topics: callbag, callbags
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/callbag-trace
- Size: 442 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# callbag-trace
[Callbag](https://github.com/callbag/callbag) operator for debugging that allows you to pass in a function (e.g. console.log) that will be called on each value as it is passed through.
`yarn --dev add callbag-trace`
## example
```js
const trace = require('callbag-trace');
const {forEach, fromEvent, map, filter, pipe} = require('callbag-basics');const accum = []
pipe(
fromEvent(document, 'click'),
filter(ev => ev.target.tagName === 'BUTTON'),
trace(console.log),
map(ev => ev.target.id),
forEach(id => accum.push(id))
)
```