Chaining in javascript can come in many forms. Here, I'll discuss method chaining, lazy chaining, and pipelining. My aim is to help me, and maybe you, understand these chaining options. This gist is inspired by Michael Fogus's O'Reilly book 'Functional JavaScript.' Like Fogus's book, I'll assume use of underscore.js as a supplement. If you're interested in functional programming in javascript, I highly recommend Fogus's book.
What do I mean by 'chaining'? Let's look over a quick example just to be on the same page. This example uses underscore.js's _.chain
method.
function findFruitCosts(groceries) {