Showing posts with label plant. Show all posts
Showing posts with label plant. Show all posts

Friday, March 6, 2015

Planting values in lodash wrappers

Wrapping values in lodash let's us compose chains of functionality. There's two reasons to do this. The first is that the resulting code is a lot more compact and readable, especially if each chained call is on it's own line. The second reason, now that lazy evaluation is supported in lodash, is efficiency. Some chains won't iterate over the entire collection if it doesn't have to. Now there's a third reason — the plant() function. This function was made available after Lo-Dash Essentials was published, so I'll talk about it here.