UI for Zipcoin Blue

flatten.js 489B

1234567891011121314151617181920212223
  1. var baseFlatten = require('./_baseFlatten');
  2. /**
  3. * Flattens `array` a single level deep.
  4. *
  5. * @static
  6. * @memberOf _
  7. * @since 0.1.0
  8. * @category Array
  9. * @param {Array} array The array to flatten.
  10. * @returns {Array} Returns the new flattened array.
  11. * @example
  12. *
  13. * _.flatten([1, [2, [3, [4]], 5]]);
  14. * // => [1, 2, [3, [4]], 5]
  15. */
  16. function flatten(array) {
  17. var length = array == null ? 0 : array.length;
  18. return length ? baseFlatten(array, 1) : [];
  19. }
  20. module.exports = flatten;