Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80742 views
1
var baseFlatten = require('../internal/baseFlatten');
2
3
/**
4
* Recursively flattens a nested array.
5
*
6
* @static
7
* @memberOf _
8
* @category Array
9
* @param {Array} array The array to recursively flatten.
10
* @returns {Array} Returns the new flattened array.
11
* @example
12
*
13
* _.flattenDeep([1, [2, 3, [4]]]);
14
* // => [1, 2, 3, 4]
15
*/
16
function flattenDeep(array) {
17
var length = array ? array.length : 0;
18
return length ? baseFlatten(array, true) : [];
19
}
20
21
module.exports = flattenDeep;
22
23