Simplify baseFlatten.

This commit is contained in:
John-David Dalton
2014-06-14 10:23:26 -07:00
parent 74c08de530
commit 1065ebb0aa

View File

@@ -1595,6 +1595,7 @@
function baseFlatten(array, isShallow, isStrict, fromIndex) {
var index = (fromIndex || 0) - 1,
length = array ? array.length : 0,
resIndex = 0,
result = [];
while (++index < length) {
@@ -1607,15 +1608,14 @@
value = baseFlatten(value, isShallow, isStrict);
}
var valIndex = -1,
valLength = value.length,
resIndex = result.length;
valLength = value.length;
result.length += valLength;
while (++valIndex < valLength) {
result[resIndex++] = value[valIndex];
}
} else if (!isStrict) {
result.push(value);
result[resIndex++] = value;
}
}
return result;