Shopify/batman — pull request #641 by hornairs (2013-01-31 03:24:33+00:00)
Title: Fix a bug in reduce where the reduction function returning undefined caused undesirable return values

@kristianpd @nickjs

A fault in the logic in `Enumerable.reduce` caused an issue where if the reduction function returned undefined, the "pick the first element of the enumerable to use as the initial value of the accumulator" logic to kick in (again, but later in the set usually). This is unexpected and wrong: the 100% should-always-be-the-case contract with reduce is whatever you return in the reduction function is the thing that gets passed to the next function, and if that thing is undefined, so be it.