mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 03:17:49 +00:00
Ensure _.sortByAll iteratee call guard works when _.partialRight is applied.
This commit is contained in:
committed by
jdalton
parent
c0110c6bab
commit
aca07530aa
@@ -6541,7 +6541,7 @@
|
|||||||
*/
|
*/
|
||||||
function sortByAll(collection) {
|
function sortByAll(collection) {
|
||||||
var args = arguments;
|
var args = arguments;
|
||||||
if (args.length == 4 && isIterateeCall(args[1], args[2], args[3])) {
|
if (args.length > 3 && isIterateeCall(args[1], args[2], args[3])) {
|
||||||
args = [collection, args[1]];
|
args = [collection, args[1]];
|
||||||
}
|
}
|
||||||
var index = -1,
|
var index = -1,
|
||||||
|
|||||||
10
test/test.js
10
test/test.js
@@ -11809,8 +11809,14 @@
|
|||||||
{ 'a': 'y', '0': 2 }
|
{ 'a': 'y', '0': 2 }
|
||||||
];
|
];
|
||||||
|
|
||||||
var actual = _.reduce([['a']], _.sortByAll, objects);
|
var funcs = [_.sortByAll, _.partialRight(_.sortByAll, 'bogus')],
|
||||||
deepEqual(actual, [objects[0], objects[2], objects[1], objects[3]]);
|
expected = _.map(funcs, _.constant([objects[0], objects[2], objects[1], objects[3]]));
|
||||||
|
|
||||||
|
var actual = _.map(funcs, function(func) {
|
||||||
|
return _.reduce([['a']], func, objects);
|
||||||
|
});
|
||||||
|
|
||||||
|
deepEqual(actual, expected);
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user