source: node_modules/ramda/es/drop.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1.1 KB
RevLine 
[d24f17c]1import _curry2 from "./internal/_curry2.js";
2import _dispatchable from "./internal/_dispatchable.js";
3import _xdrop from "./internal/_xdrop.js";
4import 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
30var 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
38export default drop;
Note: See TracBrowser for help on using the repository browser.