[d24f17c] | 1 | import _curry2 from "./internal/_curry2.js";
|
---|
| 2 | import _dispatchable from "./internal/_dispatchable.js";
|
---|
| 3 | import _xdrop from "./internal/_xdrop.js";
|
---|
| 4 | import slice from "./slice.js";
|
---|
| 5 | /**
|
---|
| 6 | * Returns all but the first `n` elements of the given list, string, or
|
---|
| 7 | * transducer/transformer (or object with a `drop` method).
|
---|
| 8 | *
|
---|
| 9 | * Dispatches to the `drop` method of the second argument, if present.
|
---|
| 10 | *
|
---|
| 11 | * @func
|
---|
| 12 | * @memberOf R
|
---|
| 13 | * @since v0.1.0
|
---|
| 14 | * @category List
|
---|
| 15 | * @sig Number -> [a] -> [a]
|
---|
| 16 | * @sig Number -> String -> String
|
---|
| 17 | * @param {Number} n
|
---|
| 18 | * @param {*} list
|
---|
| 19 | * @return {*} A copy of list without the first `n` elements
|
---|
| 20 | * @see R.take, R.transduce, R.dropLast, R.dropWhile
|
---|
| 21 | * @example
|
---|
| 22 | *
|
---|
| 23 | * R.drop(1, ['foo', 'bar', 'baz']); //=> ['bar', 'baz']
|
---|
| 24 | * R.drop(2, ['foo', 'bar', 'baz']); //=> ['baz']
|
---|
| 25 | * R.drop(3, ['foo', 'bar', 'baz']); //=> []
|
---|
| 26 | * R.drop(4, ['foo', 'bar', 'baz']); //=> []
|
---|
| 27 | * R.drop(3, 'ramda'); //=> 'da'
|
---|
| 28 | */
|
---|
| 29 |
|
---|
| 30 | var drop =
|
---|
| 31 | /*#__PURE__*/
|
---|
| 32 | _curry2(
|
---|
| 33 | /*#__PURE__*/
|
---|
| 34 | _dispatchable(['drop'], _xdrop, function drop(n, xs) {
|
---|
| 35 | return slice(Math.max(0, n), Infinity, xs);
|
---|
| 36 | }));
|
---|
| 37 |
|
---|
| 38 | export default drop; |
---|