Files
lodash/lodash.flatten/index.js
John-David Dalton d35a9c40be Bump to v4.0.0.
2018-02-03 19:13:36 -08:00

30 lines
853 B
JavaScript

/**
* lodash 4.0.0 (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
* Available under MIT license <https://lodash.com/license>
*/
var baseFlatten = require('lodash._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;