PageRenderTime 20ms CodeModel.GetById 15ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/node_modules/lodash/flatten.js

https://bitbucket.org/coleman333/smartsite
JavaScript | 22 lines | 6 code | 2 blank | 14 comment | 1 complexity | d4fd041200bec074037dbd9363d81d24 MD5 | raw file
 1var baseFlatten = require('./_baseFlatten');
 2
 3/**
 4 * Flattens `array` a single level deep.
 5 *
 6 * @static
 7 * @memberOf _
 8 * @since 0.1.0
 9 * @category Array
10 * @param {Array} array The array to flatten.
11 * @returns {Array} Returns the new flattened array.
12 * @example
13 *
14 * _.flatten([1, [2, [3, [4]], 5]]);
15 * // => [1, 2, [3, [4]], 5]
16 */
17function flatten(array) {
18  var length = array == null ? 0 : array.length;
19  return length ? baseFlatten(array, 1) : [];
20}
21
22module.exports = flatten;