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