basant307/AI_Governance_Project
045
1import baseNth from './_baseNth.js';2import baseRest from './_baseRest.js';3import toInteger from './toInteger.js';4 5/**6 * Creates a function that gets the argument at index `n`. If `n` is negative,7 * the nth argument from the end is returned.8 *9 * @static10 * @memberOf _11 * @since 4.0.012 * @category Util13 * @param {number} [n=0] The index of the argument to return.14 * @returns {Function} Returns the new pass-thru function.15 * @example16 *17 * var func = _.nthArg(1);18 * func('a', 'b', 'c', 'd');19 * // => 'b'20 *21 * var func = _.nthArg(-2);22 * func('a', 'b', 'c', 'd');23 * // => 'c'24 */25function nthArg(n) {26 n = toInteger(n);27 return baseRest(function(args) {28 return baseNth(args, n);29 });30}31 32export default nthArg;33 