Ensure _.map rewrite handles objects with non-numeric length properties correctly.

Former-commit-id: 60a4f322dcd284db5bb8ad4d8d5138e52e14cce3
This commit is contained in:
John-David Dalton
2012-10-22 01:56:50 -07:00
parent 1b0a77f9a8
commit 15f5b1f830
4 changed files with 40 additions and 27 deletions

View File

@@ -2081,7 +2081,7 @@
function map(collection, callback, thisArg) {
var index = -1,
length = collection ? collection.length : 0,
result = Array(length);
result = Array(typeof length == 'number' ? length : 0);
callback = createCallback(callback, thisArg);
if (isArray(collection)) {