UNPKG

1.12 kBJavaScriptView Raw
1var _aperture =
2/*#__PURE__*/
3require("./internal/_aperture");
4
5var _curry2 =
6/*#__PURE__*/
7require("./internal/_curry2");
8
9var _dispatchable =
10/*#__PURE__*/
11require("./internal/_dispatchable");
12
13var _xaperture =
14/*#__PURE__*/
15require("./internal/_xaperture");
16/**
17 * Returns a new list, composed of n-tuples of consecutive elements. If `n` is
18 * greater than the length of the list, an empty list is returned.
19 *
20 * Acts as a transducer if a transformer is given in list position.
21 *
22 * @func
23 * @memberOf R
24 * @since v0.12.0
25 * @category List
26 * @sig Number -> [a] -> [[a]]
27 * @param {Number} n The size of the tuples to create
28 * @param {Array} list The list to split into `n`-length tuples
29 * @return {Array} The resulting list of `n`-length tuples
30 * @see R.transduce
31 * @example
32 *
33 * R.aperture(2, [1, 2, 3, 4, 5]); //=> [[1, 2], [2, 3], [3, 4], [4, 5]]
34 * R.aperture(3, [1, 2, 3, 4, 5]); //=> [[1, 2, 3], [2, 3, 4], [3, 4, 5]]
35 * R.aperture(7, [1, 2, 3, 4, 5]); //=> []
36 */
37
38
39var aperture =
40/*#__PURE__*/
41_curry2(
42/*#__PURE__*/
43_dispatchable([], _xaperture, _aperture));
44
45module.exports = aperture;
\No newline at end of file