Sha256: 2095528cb6070b2485a8199f05ac1109236b12d84e8ac257ac800cd585f60627

Contents?: true

Size: 936 Bytes

Versions: 153

Compression:

Stored size: 936 Bytes

Contents

var baseFlatten = require('../internal/baseFlatten'),
    isIterateeCall = require('../internal/isIterateeCall');

/**
 * Flattens a nested array. If `isDeep` is `true` the array is recursively
 * flattened, otherwise it's only flattened a single level.
 *
 * @static
 * @memberOf _
 * @category Array
 * @param {Array} array The array to flatten.
 * @param {boolean} [isDeep] Specify a deep flatten.
 * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
 * @returns {Array} Returns the new flattened array.
 * @example
 *
 * _.flatten([1, [2, 3, [4]]]);
 * // => [1, 2, 3, [4]]
 *
 * // using `isDeep`
 * _.flatten([1, [2, 3, [4]]], true);
 * // => [1, 2, 3, 4]
 */
function flatten(array, isDeep, guard) {
  var length = array ? array.length : 0;
  if (guard && isIterateeCall(array, isDeep, guard)) {
    isDeep = false;
  }
  return length ? baseFlatten(array, isDeep) : [];
}

module.exports = flatten;

Version data entries

153 entries across 80 versions & 8 rubygems

Version Path
ilog-0.4.1 node_modules/contents/node_modules/lodash/array/flatten.js
ilog-0.4.1 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/array/flatten.js
ilog-0.4.1 node_modules/babel/node_modules/lodash/array/flatten.js
ilog-0.4.0 node_modules/babel/node_modules/lodash/array/flatten.js
ilog-0.4.0 node_modules/contents/node_modules/lodash/array/flatten.js
ilog-0.4.0 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/array/flatten.js
ilog-0.3.3 node_modules/babel/node_modules/lodash/array/flatten.js
ilog-0.3.3 node_modules/contents/node_modules/lodash/array/flatten.js
ilog-0.3.3 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/array/flatten.js
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/flatten.js
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/inquirer/node_modules/lodash/array/flatten.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/flatten.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/inquirer/node_modules/lodash/array/flatten.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/flatten.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/inquirer/node_modules/lodash/array/flatten.js
xcodebuild-helper-1.2.5 externals/ios-sim-master/node_modules/lodash/array/flatten.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/flatten.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/inquirer/node_modules/lodash/array/flatten.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/flatten.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/inquirer/node_modules/lodash/array/flatten.js