mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 11:57:49 +00:00
Reset resIndex after recursive baseFlatten.
This commit is contained in:
committed by
jdalton
parent
9c339367ad
commit
29e0d37009
@@ -2048,6 +2048,7 @@
|
|||||||
if (isDeep) {
|
if (isDeep) {
|
||||||
// Recursively flatten arrays (susceptible to call stack limits).
|
// Recursively flatten arrays (susceptible to call stack limits).
|
||||||
baseFlatten(value, isDeep, isStrict, result);
|
baseFlatten(value, isDeep, isStrict, result);
|
||||||
|
resIndex = result.length - 1;
|
||||||
} else {
|
} else {
|
||||||
var valIndex = -1,
|
var valIndex = -1,
|
||||||
valLength = value.length;
|
valLength = value.length;
|
||||||
|
|||||||
@@ -5215,12 +5215,12 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should support flattening of nested arrays', 3, function() {
|
test('should support flattening of nested arrays', 3, function() {
|
||||||
var array = [1, [2], [3, [4]]],
|
var array = [1, [2, 3], 4, [[5]]],
|
||||||
expected = [1, 2, 3, [4]];
|
expected = [1, 2, 3, 4, [5]];
|
||||||
|
|
||||||
deepEqual(_.flatten(array), expected);
|
deepEqual(_.flatten(array), expected);
|
||||||
|
|
||||||
expected = [1, 2, 3, 4];
|
expected = [1, 2, 3, 4, 5];
|
||||||
deepEqual(_.flatten(array, true), expected);
|
deepEqual(_.flatten(array, true), expected);
|
||||||
deepEqual(_.flattenDeep(array), expected);
|
deepEqual(_.flattenDeep(array), expected);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user