mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 17:07:49 +00:00
Bump to v4.0.0.
This commit is contained in:
21
flatten.js
Normal file
21
flatten.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import baseFlatten from './internal/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) : [];
|
||||
}
|
||||
|
||||
export default flatten;
|
||||
Reference in New Issue
Block a user