Inspecting With Tap
Easily trace pipe and compose calls using tap(). (3 min. read)
We'll cover the following...
We'll cover the following...
One of pipe's potential drawbacks is losing the ability to easily add code for debugging purposes.
Back when we had this
Jamming a console.log or little hack was easy. How do we inspect piped functions?
Introducing tap. It takes a function, usually a logger, and supplies it the current value. You can do whatever you want without affecting the pipeline since you’re just “tapping” it! :D
You don’t even need to use tap itself, just insert a function that returns its arguments unchanged.