mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Ensure fp.nthArg returns a curried function.
This commit is contained in:
@@ -143,6 +143,7 @@ function baseConvert(util, name, func, options) {
|
||||
'keys': util.keys,
|
||||
'rearg': util.rearg,
|
||||
'spread': util.spread,
|
||||
'toInteger': util.toInteger,
|
||||
'toPath': util.toPath
|
||||
};
|
||||
|
||||
@@ -156,6 +157,7 @@ function baseConvert(util, name, func, options) {
|
||||
keys = helpers.keys,
|
||||
rearg = helpers.rearg,
|
||||
spread = helpers.spread,
|
||||
toInteger = helpers.toInteger,
|
||||
toPath = helpers.toPath;
|
||||
|
||||
var aryMethodKeys = keys(mapping.aryMethod);
|
||||
@@ -209,10 +211,16 @@ function baseConvert(util, name, func, options) {
|
||||
return func;
|
||||
};
|
||||
},
|
||||
'nthArg': function(nthArg) {
|
||||
return function(n) {
|
||||
var arity = n < 0 ? 1 : (toInteger(n) + 1);
|
||||
return curry(nthArg(n), arity);
|
||||
};
|
||||
},
|
||||
'rearg': function(rearg) {
|
||||
return function(func, indexes) {
|
||||
var n = indexes ? indexes.length : 0;
|
||||
return curry(rearg(func, indexes), n);
|
||||
var arity = indexes ? indexes.length : 0;
|
||||
return curry(rearg(func, indexes), arity);
|
||||
};
|
||||
},
|
||||
'runInContext': function(runInContext) {
|
||||
|
||||
@@ -73,10 +73,10 @@ exports.aryMethod = {
|
||||
'1': [
|
||||
'assignAll', 'assignInAll', 'attempt', 'castArray', 'ceil', 'create',
|
||||
'curry', 'curryRight', 'defaultsAll', 'defaultsDeepAll', 'floor', 'flow',
|
||||
'flowRight', 'fromPairs', 'invert', 'iteratee', 'memoize', 'method',
|
||||
'mergeAll', 'methodOf', 'mixin', 'over', 'overEvery', 'overSome', 'rest',
|
||||
'reverse', 'round', 'runInContext', 'spread', 'template', 'trim', 'trimEnd',
|
||||
'trimStart', 'uniqueId', 'words', 'zipAll'
|
||||
'flowRight', 'fromPairs', 'invert', 'iteratee', 'memoize', 'method', 'mergeAll',
|
||||
'methodOf', 'mixin', 'nthArg', 'over', 'overEvery', 'overSome','rest', 'reverse',
|
||||
'round', 'runInContext', 'spread', 'template', 'trim', 'trimEnd', 'trimStart',
|
||||
'uniqueId', 'words', 'zipAll'
|
||||
],
|
||||
'2': [
|
||||
'add', 'after', 'ary', 'assign', 'assignAllWith', 'assignIn', 'assignInAllWith',
|
||||
|
||||
Reference in New Issue
Block a user