init
This commit is contained in:
32
node_modules/ramda/es/takeLast.js
generated
vendored
Normal file
32
node_modules/ramda/es/takeLast.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import _curry2 from "./internal/_curry2.js";
|
||||
import drop from "./drop.js";
|
||||
/**
|
||||
* Returns a new list containing the last `n` elements of the given list.
|
||||
* If `n > list.length`, returns a list of `list.length` elements.
|
||||
*
|
||||
* @func
|
||||
* @memberOf R
|
||||
* @since v0.16.0
|
||||
* @category List
|
||||
* @sig Number -> [a] -> [a]
|
||||
* @sig Number -> String -> String
|
||||
* @param {Number} n The number of elements to return.
|
||||
* @param {Array} xs The collection to consider.
|
||||
* @return {Array}
|
||||
* @see R.dropLast
|
||||
* @example
|
||||
*
|
||||
* R.takeLast(1, ['foo', 'bar', 'baz']); //=> ['baz']
|
||||
* R.takeLast(2, ['foo', 'bar', 'baz']); //=> ['bar', 'baz']
|
||||
* R.takeLast(3, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz']
|
||||
* R.takeLast(4, ['foo', 'bar', 'baz']); //=> ['foo', 'bar', 'baz']
|
||||
* R.takeLast(3, 'ramda'); //=> 'mda'
|
||||
*/
|
||||
|
||||
var takeLast =
|
||||
/*#__PURE__*/
|
||||
_curry2(function takeLast(n, xs) {
|
||||
return drop(n >= 0 ? xs.length - n : 0, xs);
|
||||
});
|
||||
|
||||
export default takeLast;
|
Reference in New Issue
Block a user