mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 01:47:48 +00:00
Remove fp iterateeRearg mapping. [closes #1971]
This commit is contained in:
@@ -109,13 +109,6 @@ function baseConvert(util, name, func, options) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var iterateeRearg = function(func, indexes) {
|
|
||||||
return overArg(func, function(func) {
|
|
||||||
var n = indexes.length;
|
|
||||||
return baseArity(rearg(baseAry(func, n), indexes), n);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
var overArg = function(func, iteratee, retArg) {
|
var overArg = function(func, iteratee, retArg) {
|
||||||
return function() {
|
return function() {
|
||||||
var length = arguments.length;
|
var length = arguments.length;
|
||||||
@@ -207,7 +200,6 @@ function baseConvert(util, name, func, options) {
|
|||||||
each(mapping.aryMethod[cap], function(otherName) {
|
each(mapping.aryMethod[cap], function(otherName) {
|
||||||
if (name == otherName) {
|
if (name == otherName) {
|
||||||
var aryN = !isLib && mapping.iterateeAry[name],
|
var aryN = !isLib && mapping.iterateeAry[name],
|
||||||
reargIndexes = mapping.iterateeRearg[name],
|
|
||||||
spreadStart = mapping.methodSpread[name];
|
spreadStart = mapping.methodSpread[name];
|
||||||
|
|
||||||
result = wrapped;
|
result = wrapped;
|
||||||
@@ -219,12 +211,8 @@ function baseConvert(util, name, func, options) {
|
|||||||
if (config.rearg && cap > 1 && (forceRearg || !mapping.skipRearg[name])) {
|
if (config.rearg && cap > 1 && (forceRearg || !mapping.skipRearg[name])) {
|
||||||
result = rearg(result, mapping.methodRearg[name] || mapping.aryRearg[cap]);
|
result = rearg(result, mapping.methodRearg[name] || mapping.aryRearg[cap]);
|
||||||
}
|
}
|
||||||
if (config.cap) {
|
if (config.cap && aryN) {
|
||||||
if (reargIndexes) {
|
result = iterateeAry(result, aryN);
|
||||||
result = iterateeRearg(result, reargIndexes);
|
|
||||||
} else if (aryN) {
|
|
||||||
result = iterateeAry(result, aryN);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (config.curry && cap > 1) {
|
if (config.curry && cap > 1) {
|
||||||
result = curry(result, cap);
|
result = curry(result, cap);
|
||||||
|
|||||||
@@ -127,13 +127,6 @@ exports.iterateeAry = {
|
|||||||
'transform': 2
|
'transform': 2
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Used to map method names to iteratee rearg configs. */
|
|
||||||
exports.iterateeRearg = {
|
|
||||||
'findKey': [1],
|
|
||||||
'findLastKey': [1],
|
|
||||||
'mapKeys': [1]
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Used to map method names to rearg configs. */
|
/** Used to map method names to rearg configs. */
|
||||||
exports.methodRearg = {
|
exports.methodRearg = {
|
||||||
'assignInWith': [1, 2, 0],
|
'assignInWith': [1, 2, 0],
|
||||||
|
|||||||
@@ -458,28 +458,6 @@
|
|||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
QUnit.module('key methods');
|
|
||||||
|
|
||||||
(function() {
|
|
||||||
var object = { 'a': 1 };
|
|
||||||
|
|
||||||
QUnit.test('should provide the correct `iteratee` arguments', function(assert) {
|
|
||||||
assert.expect(3);
|
|
||||||
|
|
||||||
_.each(['findKey', 'findLastKey', 'mapKeys'], function(methodName) {
|
|
||||||
var args;
|
|
||||||
|
|
||||||
var actual = fp[methodName](function() {
|
|
||||||
args || (args = slice.call(arguments));
|
|
||||||
}, object);
|
|
||||||
|
|
||||||
assert.deepEqual(args, ['a'], 'fp.' + methodName);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}());
|
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
QUnit.module('mutation methods');
|
QUnit.module('mutation methods');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user