Last change
on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
577 bytes
|
Line | |
---|
1 | var baseFlatten = require('./_baseFlatten');
|
---|
2 |
|
---|
3 | /** Used as references for various `Number` constants. */
|
---|
4 | var INFINITY = 1 / 0;
|
---|
5 |
|
---|
6 | /**
|
---|
7 | * Recursively flattens `array`.
|
---|
8 | *
|
---|
9 | * @static
|
---|
10 | * @memberOf _
|
---|
11 | * @since 3.0.0
|
---|
12 | * @category Array
|
---|
13 | * @param {Array} array The array to flatten.
|
---|
14 | * @returns {Array} Returns the new flattened array.
|
---|
15 | * @example
|
---|
16 | *
|
---|
17 | * _.flattenDeep([1, [2, [3, [4]], 5]]);
|
---|
18 | * // => [1, 2, 3, 4, 5]
|
---|
19 | */
|
---|
20 | function flattenDeep(array) {
|
---|
21 | var length = array == null ? 0 : array.length;
|
---|
22 | return length ? baseFlatten(array, INFINITY) : [];
|
---|
23 | }
|
---|
24 |
|
---|
25 | module.exports = flattenDeep;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.