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