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

flattenDeep.js 577B

12345678910111213141516171819202122232425
  1. var baseFlatten = require('./_baseFlatten');
  2. /** Used as references for various `Number` constants. */
  3. var INFINITY = 1 / 0;
  4. /**
  5. * Recursively flattens `array`.
  6. *
  7. * @static
  8. * @memberOf _
  9. * @since 3.0.0
  10. * @category Array
  11. * @param {Array} array The array to flatten.
  12. * @returns {Array} Returns the new flattened array.
  13. * @example
  14. *
  15. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  16. * // => [1, 2, 3, 4, 5]
  17. */
  18. function flattenDeep(array) {
  19. var length = array == null ? 0 : array.length;
  20. return length ? baseFlatten(array, INFINITY) : [];
  21. }
  22. module.exports = flattenDeep;