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 |
|
---|
27 | var aperture =
|
---|
28 | /*#__PURE__*/
|
---|
29 | _curry2(
|
---|
30 | /*#__PURE__*/
|
---|
31 | _dispatchable([], _xaperture, _aperture));
|
---|
32 |
|
---|
33 | export default aperture; |
---|