25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

32 satır
1.0 KiB

4 yıl önce
  1. import _aperture from "./internal/_aperture.js";
  2. import _curry2 from "./internal/_curry2.js";
  3. import _dispatchable from "./internal/_dispatchable.js";
  4. import _xaperture from "./internal/_xaperture.js";
  5. /**
  6. * Returns a new list, composed of n-tuples of consecutive elements. If `n` is
  7. * greater than the length of the list, an empty list is returned.
  8. *
  9. * Acts as a transducer if a transformer is given in list position.
  10. *
  11. * @func
  12. * @memberOf R
  13. * @since v0.12.0
  14. * @category List
  15. * @sig Number -> [a] -> [[a]]
  16. * @param {Number} n The size of the tuples to create
  17. * @param {Array} list The list to split into `n`-length tuples
  18. * @return {Array} The resulting list of `n`-length tuples
  19. * @see R.transduce
  20. * @example
  21. *
  22. * R.aperture(2, [1, 2, 3, 4, 5]); //=> [[1, 2], [2, 3], [3, 4], [4, 5]]
  23. * R.aperture(3, [1, 2, 3, 4, 5]); //=> [[1, 2, 3], [2, 3, 4], [3, 4, 5]]
  24. * R.aperture(7, [1, 2, 3, 4, 5]); //=> []
  25. */
  26. var aperture =
  27. /*#__PURE__*/
  28. _curry2(
  29. /*#__PURE__*/
  30. _dispatchable([], _xaperture, _aperture));
  31. export default aperture;