reduced.js 992 B

1234567891011121314151617181920212223242526272829303132333435
  1. import _curry1 from "./internal/_curry1.js";
  2. import _reduced from "./internal/_reduced.js";
  3. /**
  4. * Returns a value wrapped to indicate that it is the final value of the reduce
  5. * and transduce functions. The returned value should be considered a black
  6. * box: the internal structure is not guaranteed to be stable.
  7. *
  8. * This optimization is available to the below functions:
  9. * - [`reduce`](#reduce)
  10. * - [`reduceWhile`](#reduceWhile)
  11. * - [`reduceBy`](#reduceBy)
  12. * - [`reduceRight`](#reduceRight)
  13. * - [`transduce`](#transduce)
  14. *
  15. * @func
  16. * @memberOf R
  17. * @since v0.15.0
  18. * @category List
  19. * @sig a -> *
  20. * @param {*} x The final value of the reduce.
  21. * @return {*} The wrapped value.
  22. * @see R.reduce, R.reduceWhile, R.reduceBy, R.reduceRight, R.transduce
  23. * @example
  24. *
  25. * R.reduce(
  26. * (acc, item) => item > 3 ? R.reduced(acc) : acc.concat(item),
  27. * [],
  28. * [1, 2, 3, 4, 5]) // [1, 2, 3]
  29. */
  30. var reduced =
  31. /*#__PURE__*/
  32. _curry1(_reduced);
  33. export default reduced;