UI for Zipcoin Blue

flattenDeep.js 577B

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