mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 18:07:49 +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) {
|
function createOver(arrayFunc) {
|
||||||
return rest(function(iteratees) {
|
return rest(function(iteratees) {
|
||||||
|
var toIteratee = getIteratee();
|
||||||
|
|
||||||
iteratees = (iteratees.length == 1 && isArray(iteratees[0]))
|
iteratees = (iteratees.length == 1 && isArray(iteratees[0]))
|
||||||
? arrayMap(iteratees[0], getIteratee())
|
? iteratees[0]
|
||||||
: arrayMap(baseFlatten(iteratees, 1, isFlattenableIteratee), getIteratee());
|
: baseFlatten(iteratees, 1, isFlattenableIteratee);
|
||||||
|
|
||||||
|
iteratees = arrayMap(iteratees, function(iteratee) {
|
||||||
|
return toIteratee(iteratee, Infinity);
|
||||||
|
});
|
||||||
|
|
||||||
return rest(function(args) {
|
return rest(function(args) {
|
||||||
var thisArg = this;
|
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');
|
QUnit.module('fp.omitBy and fp.pickBy');
|
||||||
|
|
||||||
_.each(['omitBy', 'pickBy'], function(methodName) {
|
_.each(['omitBy', 'pickBy'], function(methodName) {
|
||||||
|
|||||||
Reference in New Issue
Block a user