Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

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;