-
Book Overview & Buying
-
Table Of Contents
Lo-Dash Essentials
By :
So far, the examples we've looked at in this book used Lo-Dash functions independently of one another. That's not to say they're not working together; it's just that they could be cleaner, or more condensed. We would call the function to compute a value, store that value, call another function to compute a new value using the stored value as an argument, and repeat the same process. This is exhausting but can be easily remedied.
The idea is to streamline this functionality into a chain of calls. This approach follows the concept of applicative programming, whereby we have a starting collection and at each stage in the chain, that collection is transformed. It's like an assembly line where the resulting product is a value that you need in a given context.
Lo-Dash enables this mode of programming through the wrapper concept—a constructor function used to wrap primitive values that enable chained function calls. In this chapter...
Change the font size
Change margin width
Change background colour