blob: 6a6b8cf7c696983f4524d6209fb3d944c2b6d452 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
var baseFlatten = require('./_baseFlatten');
/**
* Flattens `array` a single level.
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to flatten.
* @returns {Array} Returns the new flattened array.
* @example
*
* _.flatten([1, [2, 3, [4]]]);
* // => [1, 2, 3, [4]]
*/
function flatten(array) {
var length = array ? array.length : 0;
return length ? baseFlatten(array) : [];
}
module.exports = flatten;
|