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.

26 lines
645 B

4 years ago
  1. import _curry1 from "./internal/_curry1.js";
  2. import _makeFlat from "./internal/_makeFlat.js";
  3. /**
  4. * Returns a new list by pulling every item out of it (and all its sub-arrays)
  5. * and putting them in a new array, depth-first.
  6. *
  7. * @func
  8. * @memberOf R
  9. * @since v0.1.0
  10. * @category List
  11. * @sig [a] -> [b]
  12. * @param {Array} list The array to consider.
  13. * @return {Array} The flattened list.
  14. * @see R.unnest
  15. * @example
  16. *
  17. * R.flatten([1, 2, [3, 4], 5, [6, [7, 8, [9, [10, 11], 12]]]]);
  18. * //=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
  19. */
  20. var flatten =
  21. /*#__PURE__*/
  22. _curry1(
  23. /*#__PURE__*/
  24. _makeFlat(true));
  25. export default flatten;