Bump to v4.11.0.

This commit is contained in:
John-David Dalton
2016-04-12 22:28:19 -07:00
parent be0bf2681b
commit 63ba93dcb3
28 changed files with 390 additions and 271 deletions

View File

@@ -1,7 +1,10 @@
var toInteger = require('./toInteger');
var baseNth = require('./_baseNth'),
rest = require('./rest'),
toInteger = require('./toInteger');
/**
* Creates a function that returns its nth argument.
* Creates a function that returns its nth argument. If `n` is negative,
* the nth argument from the end is returned.
*
* @static
* @memberOf _
@@ -12,15 +15,18 @@ var toInteger = require('./toInteger');
* @example
*
* var func = _.nthArg(1);
*
* func('a', 'b', 'c');
* func('a', 'b', 'c', 'd');
* // => 'b'
*
* var func = _.nthArg(-2);
* func('a', 'b', 'c', 'd');
* // => 'c'
*/
function nthArg(n) {
n = toInteger(n);
return function() {
return arguments[n];
};
return rest(function(args) {
return baseNth(args, n);
});
}
module.exports = nthArg;