Showing posts with label flatten. Show all posts
Showing posts with label flatten. Show all posts

Tuesday, December 10, 2013

Chains and Flattened Arrays

The Lodash JavaScript utility library has plenty of array and collection functions, such as _.flatten(). Often, we end up having to apply several of these functions in succession in order to end up with the desired result. This becomes a much simpler programming task when using the _.chain() function to setup a chainable object first. The end result is a less awkward approach to successive function calls on the same object.