From cf5d6b5bc84c8863fc07b1658ceab95b4ffe03e9 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 4 Apr 2016 09:56:22 -0700 Subject: [PATCH] Revert #2193. --- fp/_mapping.js | 4 ---- lodash.js | 12 ++++++------ test/test.js | 21 +++++++++++++++++++++ 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/fp/_mapping.js b/fp/_mapping.js index e897d751d..d9d43fd93 100644 --- a/fp/_mapping.js +++ b/fp/_mapping.js @@ -165,10 +165,6 @@ exports.methodRearg = { exports.methodSpread = { 'invokeArgs': 2, 'invokeArgsMap': 2, - 'over': 0, - 'overArgs': 1, - 'overEvery': 0, - 'overSome': 0, 'partial': 1, 'partialRight': 1, 'without': 1 diff --git a/lodash.js b/lodash.js index a144f8e61..ee35f31d3 100644 --- a/lodash.js +++ b/lodash.js @@ -4608,7 +4608,7 @@ */ function createOver(arrayFunc) { return rest(function(iteratees) { - iteratees = arrayMap(iteratees, getIteratee()); + iteratees = arrayMap(baseFlatten(iteratees, 1), getIteratee()); return rest(function(args) { var thisArg = this; return arrayFunc(iteratees, function(iteratee) { @@ -9592,7 +9592,7 @@ * @memberOf _ * @category Function * @param {Function} func The function to wrap. - * @param {...Function} [transforms] The functions to transform + * @param {...(Function|Function[])} [transforms] The functions to transform. * arguments, specified individually or in arrays. * @returns {Function} Returns the new function. * @example @@ -9616,7 +9616,7 @@ * // => [100, 10] */ var overArgs = rest(function(func, transforms) { - transforms = arrayMap(transforms, getIteratee()); + transforms = arrayMap(baseFlatten(transforms, 1), getIteratee()); var funcsLength = transforms.length; return rest(function(args) { @@ -14691,7 +14691,7 @@ * @memberOf _ * @since 4.0.0 * @category Util - * @param {...Function} iteratees The iteratees to invoke. + * @param {...(Function|Function[])} iteratees The iteratees to invoke. * @returns {Function} Returns the new function. * @example * @@ -14710,7 +14710,7 @@ * @memberOf _ * @since 4.0.0 * @category Util - * @param {...Function} predicates The predicates to check. + * @param {...(Function|Function[])} predicates The predicates to check. * @returns {Function} Returns the new function. * @example * @@ -14735,7 +14735,7 @@ * @memberOf _ * @since 4.0.0 * @category Util - * @param {...Function} predicates The predicates to check. + * @param {...(Function|Function[])} predicates The predicates to check. * @returns {Function} Returns the new function. * @example * diff --git a/test/test.js b/test/test.js index 328be4460..7a4c97b5d 100644 --- a/test/test.js +++ b/test/test.js @@ -15583,6 +15583,13 @@ assert.deepEqual(over(5, 10), [10, 100]); }); + QUnit.test('should flatten `transforms`', function(assert) { + assert.expect(1); + + var over = _.overArgs(fn, [doubled, square], String); + assert.deepEqual(over(5, 10, 15), [10, 100, '15']); + }); + QUnit.test('should not transform any argument greater than the number of transforms', function(assert) { assert.expect(1); @@ -16109,6 +16116,13 @@ assert.strictEqual(over(object), false); }); + QUnit.test('should flatten `predicates`', function(assert) { + assert.expect(1); + + var over = _.overEvery(alwaysTrue, [alwaysFalse]); + assert.strictEqual(over(), false); + }); + QUnit.test('should provide arguments to predicates', function(assert) { assert.expect(1); @@ -16204,6 +16218,13 @@ assert.strictEqual(over(object), false); }); + QUnit.test('should flatten `predicates`', function(assert) { + assert.expect(1); + + var over = _.overSome(alwaysFalse, [alwaysTrue]); + assert.strictEqual(over(), true); + }); + QUnit.test('should provide arguments to predicates', function(assert) { assert.expect(1);