Intermediary results

There are times when we don't want to wait until the call chain is terminated to have access to values computed at any given step along the way. Think about cases where the intermediate value produced by a function in the chain should be used by another function later in the chain. On other occasions, we need to completely override the value returned by the chain.

Tapping into chains

We can use the tap() function to inject our own callback function into the chain. This is different from the callbacks that we'd supply to other Lo-Dash functions. It doesn't alter the value as it flows through the chain of function calls. Instead, think of tap() as a way of intercepting values as they flow through the chain, and possibly reacting ...

Get Lo-Dash Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.