Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

flatten.js 489B

12345678910111213141516171819202122
  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;