Fixing #95 ... Maloptimization of _.keys for sparse arrays.

This commit is contained in:
Jeremy Ashkenas
2011-01-18 16:34:33 -05:00
parent 49787c212d
commit 2f369f8eca

View File

@@ -501,7 +501,6 @@
// Retrieve the names of an object's properties.
// Delegates to **ECMAScript 5**'s native `Object.keys`
_.keys = nativeKeys || function(obj) {
if (_.isArray(obj)) return _.range(0, obj.length);
var keys = [];
for (var key in obj) if (hasOwnProperty.call(obj, key)) keys[keys.length] = key;
return keys;