source: node_modules/ramda/es/nthArg.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: 705 bytes
Line 
1import _curry1 from "./internal/_curry1.js";
2import curryN from "./curryN.js";
3import nth from "./nth.js";
4/**
5 * Returns a function which returns its nth argument.
6 *
7 * @func
8 * @memberOf R
9 * @since v0.9.0
10 * @category Function
11 * @sig Number -> *... -> *
12 * @param {Number} n
13 * @return {Function}
14 * @example
15 *
16 * R.nthArg(1)('a', 'b', 'c'); //=> 'b'
17 * R.nthArg(-1)('a', 'b', 'c'); //=> 'c'
18 * @symb R.nthArg(-1)(a, b, c) = c
19 * @symb R.nthArg(0)(a, b, c) = a
20 * @symb R.nthArg(1)(a, b, c) = b
21 */
22
23var nthArg =
24/*#__PURE__*/
25_curry1(function nthArg(n) {
26 var arity = n < 0 ? 1 : n + 1;
27 return curryN(arity, function () {
28 return nth(n, arguments);
29 });
30});
31
32export default nthArg;
Note: See TracBrowser for help on using the repository browser.