Skip to content
This repository

_.each fails on objects with a length property #448

gonsfx opened this Issue January 27, 2012 · 1 comment

1 participant

Christoph Werner
Christoph Werner

because of this check

obj.length === +obj.length

objects with a length property get treated as an array.

// logs nothing
_.each({ one: 1, two: 2, length: 3 }, function(num) { console.log(num); });

is this the desired behavior? even though this should be faster than {} === '[object Array]', this doesn't seem right.

Christoph Werner gonsfx closed this January 27, 2012
Christoph Werner

seems this has been discussed before.
sorry for the inconvenience ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.