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.
Showing posts with label wrapper. Show all posts
Showing posts with label wrapper. Show all posts
Friday, March 6, 2015
Wednesday, June 11, 2014
Wrapping Functions In Web Workers
It's commonplace, now that JavaScript has matured, and is continuing to mature, to implement heavy-duty data-crunching operations in the front-end. For instance, rather than calling an API to reduce a large set, it's easier to just reduce it in the browser. The wins are that you don't have to support an API to do this, and there's no network overhead. However, there's a new kind of overhead in that the browser will eat up valuable seconds while performing these long-running tasks. And since JavaScript code is single-threaded, these tasks diminish DOM responsiveness.
Subscribe to:
Posts
(
Atom
)