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
|
Rev | Line | |
---|
[d24f17c] | 1 | var _curry1 =
|
---|
| 2 | /*#__PURE__*/
|
---|
| 3 | require("./internal/_curry1.js");
|
---|
| 4 |
|
---|
| 5 | var curryN =
|
---|
| 6 | /*#__PURE__*/
|
---|
| 7 | require("./curryN.js");
|
---|
| 8 |
|
---|
| 9 | var nth =
|
---|
| 10 | /*#__PURE__*/
|
---|
| 11 | require("./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 |
|
---|
| 32 | var 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 |
|
---|
| 41 | module.exports = nthArg; |
---|
Note:
See
TracBrowser
for help on using the repository browser.