Composing functions

Whether our functions are called manually, used as a callback by another function, or used in some other context that involves chains, function composition helps construct larger pieces of functionality. For example, we may have two smaller functions that serve niche purposes on their own. When we're in scenarios where these functions may come in handy, we can use the functional tools in Lo-Dash to compose a new function that utilizes them, rather than roll out our own.

Composing generic functions

Earlier in the chapter, we emphasized the idea that functions need to be generic if they're to be of any service in more than one context. The same idea holds true when composing larger components of smaller functions. The smaller functions ...

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.