jashkenas/underscore — pull request #1926 by ilyakamens (2014-11-08 01:59:37+00:00)
Title: Modifying _.each to properly handle objects with a "length" property

_.each currently treats objects with an arbitrary and numerical "length" property as arrays and doesn't process them properly.

For example, {a: 1, b: 2, length: 4} will try to be iterated over as an array, which doesn't work.

My change ensures the "length" property used in _.each is used to describe the number of elements of the actual object. I added a test case for what I've described.