UNPKG

1.19 kBJavaScriptView Raw
1var _curry2 =
2/*#__PURE__*/
3require("./internal/_curry2");
4
5var _dispatchable =
6/*#__PURE__*/
7require("./internal/_dispatchable");
8
9var _xdrop =
10/*#__PURE__*/
11require("./internal/_xdrop");
12
13var slice =
14/*#__PURE__*/
15require("./slice");
16/**
17 * Returns all but the first `n` elements of the given list, string, or
18 * transducer/transformer (or object with a `drop` method).
19 *
20 * Dispatches to the `drop` method of the second argument, if present.
21 *
22 * @func
23 * @memberOf R
24 * @since v0.1.0
25 * @category List
26 * @sig Number -> [a] -> [a]
27 * @sig Number -> String -> String
28 * @param {Number} n
29 * @param {*} list
30 * @return {*} A copy of list without the first `n` elements
31 * @see R.take, R.transduce, R.dropLast, R.dropWhile
32 * @example
33 *
34 * R.drop(1, ['foo', 'bar', 'baz']); //=> ['bar', 'baz']
35 * R.drop(2, ['foo', 'bar', 'baz']); //=> ['baz']
36 * R.drop(3, ['foo', 'bar', 'baz']); //=> []
37 * R.drop(4, ['foo', 'bar', 'baz']); //=> []
38 * R.drop(3, 'ramda'); //=> 'da'
39 */
40
41
42var drop =
43/*#__PURE__*/
44_curry2(
45/*#__PURE__*/
46_dispatchable(['drop'], _xdrop, function drop(n, xs) {
47 return slice(Math.max(0, n), Infinity, xs);
48}));
49
50module.exports = drop;
\No newline at end of file