_.nthArg([n=0])
Creates a function that gets the argument at index n
. If n
is negative, the nth argument from the end is returned.
Since
4.0.0
Arguments
[n=0]
(number): The index of the argument to return.
Returns
(Function): Returns the new pass-thru function.
Example
var func = _.nthArg(1);func('a', 'b', 'c', 'd');// => 'b'var func = _.nthArg(-2);func('a', 'b', 'c', 'd');// => 'c'
当前内容版权归 lodash.com 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 lodash.com .