mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
Ensure fp.over doesn't cap its iteratee args.
This commit is contained in:
10
lodash.js
10
lodash.js
@@ -4624,9 +4624,15 @@
|
||||
*/
|
||||
function createOver(arrayFunc) {
|
||||
return rest(function(iteratees) {
|
||||
var toIteratee = getIteratee();
|
||||
|
||||
iteratees = (iteratees.length == 1 && isArray(iteratees[0]))
|
||||
? arrayMap(iteratees[0], getIteratee())
|
||||
: arrayMap(baseFlatten(iteratees, 1, isFlattenableIteratee), getIteratee());
|
||||
? iteratees[0]
|
||||
: baseFlatten(iteratees, 1, isFlattenableIteratee);
|
||||
|
||||
iteratees = arrayMap(iteratees, function(iteratee) {
|
||||
return toIteratee(iteratee, Infinity);
|
||||
});
|
||||
|
||||
return rest(function(args) {
|
||||
var thisArg = this;
|
||||
|
||||
@@ -1443,6 +1443,21 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('fp.over');
|
||||
|
||||
(function() {
|
||||
QUnit.test('should not cap iteratee args', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
_.each([fp.over, convert('over', _.over)], function(func) {
|
||||
var over = func([Math.max, Math.min]);
|
||||
assert.deepEqual(over(1, 2, 3, 4), [4, 1]);
|
||||
});
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('fp.omitBy and fp.pickBy');
|
||||
|
||||
_.each(['omitBy', 'pickBy'], function(methodName) {
|
||||
|
||||
Reference in New Issue
Block a user