flattenDepth
_.flattenDepth(depth, array)
# Ⓢ [Ⓣ][1] Ⓝ
Recursively flatten array up to depth times.
Since
4.4.0
Arguments
depth(number): The maximum recursion depth.array(Array): The array to flatten.
Returns
(Array): Returns the new flattened array.
Example
var array = [1, [2, [3, [4]], 5]];
_.flattenDepth(1, array);
// => [1, 2, [3, [4]], 5]
_.flattenDepth(2, array);
// => [1, 2, 3, [4], 5]