1 | var _checkForMethod =
|
2 | /*#__PURE__*/
|
3 | require("./internal/_checkForMethod");
|
4 |
|
5 | var _curry3 =
|
6 | /*#__PURE__*/
|
7 | require("./internal/_curry3");
|
8 | /**
|
9 | * Returns the elements of the given list or string (or object with a `slice`
|
10 | * method) from `fromIndex` (inclusive) to `toIndex` (exclusive).
|
11 | *
|
12 | * Dispatches to the `slice` method of the third argument, if present.
|
13 | *
|
14 | * @func
|
15 | * @memberOf R
|
16 | * @since v0.1.4
|
17 | * @category List
|
18 | * @sig Number -> Number -> [a] -> [a]
|
19 | * @sig Number -> Number -> String -> String
|
20 | * @param {Number} fromIndex The start index (inclusive).
|
21 | * @param {Number} toIndex The end index (exclusive).
|
22 | * @param {*} list
|
23 | * @return {*}
|
24 | * @example
|
25 | *
|
26 | * R.slice(1, 3, ['a', 'b', 'c', 'd']); //=> ['b', 'c']
|
27 | * R.slice(1, Infinity, ['a', 'b', 'c', 'd']); //=> ['b', 'c', 'd']
|
28 | * R.slice(0, -1, ['a', 'b', 'c', 'd']); //=> ['a', 'b', 'c']
|
29 | * R.slice(-3, -1, ['a', 'b', 'c', 'd']); //=> ['b', 'c']
|
30 | * R.slice(0, 3, 'ramda'); //=> 'ram'
|
31 | */
|
32 |
|
33 |
|
34 | var slice =
|
35 | /*#__PURE__*/
|
36 | _curry3(
|
37 | /*#__PURE__*/
|
38 | _checkForMethod('slice', function slice(fromIndex, toIndex, list) {
|
39 | return Array.prototype.slice.call(list, fromIndex, toIndex);
|
40 | }));
|
41 |
|
42 | module.exports = slice; |
\ | No newline at end of file |