You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If banana.length is a string, rather then an integer, it suddenly works. When I did I search I saw a long discussion on this subject back in march. Any head way made? This really surprised me when I came across it. There's nothing in the documentation saying this is a failure case when foreaching over an object.
I have a situation where I can't rename the key so I've had to ditch underscore temporarily.
The text was updated successfully, but these errors were encountered:
See 5eaf71f, 942d6312, and 727db393 for the recent change that affected this. Still, an object with a numeric length value was treated as an array by _.each before then. That was decided long before those commits, and it's a decision I support.
var _ = require('underscore');
banana = {
length: 999
}
_.each(banana, function(val) {
console.log('Got Here'); //fails
})
If banana.length is a string, rather then an integer, it suddenly works. When I did I search I saw a long discussion on this subject back in march. Any head way made? This really surprised me when I came across it. There's nothing in the documentation saying this is a failure case when foreaching over an object.
I have a situation where I can't rename the key so I've had to ditch underscore temporarily.
The text was updated successfully, but these errors were encountered: