mirror of
https://github.com/swc-project/swc.git
synced 2024-12-24 22:22:34 +03:00
bbaf619f63
swc_bundler: - [x] Fix wrapped esms. (denoland/deno#9307) - [x] Make test secure.
34 lines
759 B
TypeScript
34 lines
759 B
TypeScript
// Loaded from https://deno.land/x/ramda@v0.27.2/source/nthArg.js
|
|
|
|
|
|
import _curry1 from './internal/_curry1.js';
|
|
import curryN from './curryN.js';
|
|
import nth from './nth.js';
|
|
|
|
|
|
/**
|
|
* Returns a function which returns its nth argument.
|
|
*
|
|
* @func
|
|
* @memberOf R
|
|
* @since v0.9.0
|
|
* @category Function
|
|
* @sig Number -> *... -> *
|
|
* @param {Number} n
|
|
* @return {Function}
|
|
* @example
|
|
*
|
|
* R.nthArg(1)('a', 'b', 'c'); //=> 'b'
|
|
* R.nthArg(-1)('a', 'b', 'c'); //=> 'c'
|
|
* @symb R.nthArg(-1)(a, b, c) = c
|
|
* @symb R.nthArg(0)(a, b, c) = a
|
|
* @symb R.nthArg(1)(a, b, c) = b
|
|
*/
|
|
var nthArg = _curry1(function nthArg(n) {
|
|
var arity = n < 0 ? 1 : n + 1;
|
|
return curryN(arity, function() {
|
|
return nth(n, arguments);
|
|
});
|
|
});
|
|
export default nthArg;
|