Simplify Utils.merge to use Array.forEach and Array.push for bug 582023.

This commit is contained in:
Edward Lee 2010-07-29 13:02:51 -07:00
parent 88ef92422f
commit 183c85bc14

View File

@ -666,22 +666,9 @@ let Utils = {
// ----------
// Function: merge
// Merge two arrays and return the result.
// Merge two array-like objects into the first and return it.
merge: function(first, second) {
var i = first.length, j = 0;
if (typeof second.length === "number") {
for (let l = second.length; j < l; j++) {
first[i++] = second[j];
}
} else {
while (second[j] !== undefined) {
first[i++] = second[j++];
}
}
first.length = i;
Array.forEach(second, function(el) Array.push(first, el));
return first;
},