This commit is contained in:
John-David Dalton
2016-04-04 09:56:22 -07:00
parent 7a6b64b2f6
commit cf5d6b5bc8
3 changed files with 27 additions and 10 deletions

View File

@@ -165,10 +165,6 @@ exports.methodRearg = {
exports.methodSpread = { exports.methodSpread = {
'invokeArgs': 2, 'invokeArgs': 2,
'invokeArgsMap': 2, 'invokeArgsMap': 2,
'over': 0,
'overArgs': 1,
'overEvery': 0,
'overSome': 0,
'partial': 1, 'partial': 1,
'partialRight': 1, 'partialRight': 1,
'without': 1 'without': 1

View File

@@ -4608,7 +4608,7 @@
*/ */
function createOver(arrayFunc) { function createOver(arrayFunc) {
return rest(function(iteratees) { return rest(function(iteratees) {
iteratees = arrayMap(iteratees, getIteratee()); iteratees = arrayMap(baseFlatten(iteratees, 1), getIteratee());
return rest(function(args) { return rest(function(args) {
var thisArg = this; var thisArg = this;
return arrayFunc(iteratees, function(iteratee) { return arrayFunc(iteratees, function(iteratee) {
@@ -9592,7 +9592,7 @@
* @memberOf _ * @memberOf _
* @category Function * @category Function
* @param {Function} func The function to wrap. * @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. * arguments, specified individually or in arrays.
* @returns {Function} Returns the new function. * @returns {Function} Returns the new function.
* @example * @example
@@ -9616,7 +9616,7 @@
* // => [100, 10] * // => [100, 10]
*/ */
var overArgs = rest(function(func, transforms) { var overArgs = rest(function(func, transforms) {
transforms = arrayMap(transforms, getIteratee()); transforms = arrayMap(baseFlatten(transforms, 1), getIteratee());
var funcsLength = transforms.length; var funcsLength = transforms.length;
return rest(function(args) { return rest(function(args) {
@@ -14691,7 +14691,7 @@
* @memberOf _ * @memberOf _
* @since 4.0.0 * @since 4.0.0
* @category Util * @category Util
* @param {...Function} iteratees The iteratees to invoke. * @param {...(Function|Function[])} iteratees The iteratees to invoke.
* @returns {Function} Returns the new function. * @returns {Function} Returns the new function.
* @example * @example
* *
@@ -14710,7 +14710,7 @@
* @memberOf _ * @memberOf _
* @since 4.0.0 * @since 4.0.0
* @category Util * @category Util
* @param {...Function} predicates The predicates to check. * @param {...(Function|Function[])} predicates The predicates to check.
* @returns {Function} Returns the new function. * @returns {Function} Returns the new function.
* @example * @example
* *
@@ -14735,7 +14735,7 @@
* @memberOf _ * @memberOf _
* @since 4.0.0 * @since 4.0.0
* @category Util * @category Util
* @param {...Function} predicates The predicates to check. * @param {...(Function|Function[])} predicates The predicates to check.
* @returns {Function} Returns the new function. * @returns {Function} Returns the new function.
* @example * @example
* *

View File

@@ -15583,6 +15583,13 @@
assert.deepEqual(over(5, 10), [10, 100]); 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) { QUnit.test('should not transform any argument greater than the number of transforms', function(assert) {
assert.expect(1); assert.expect(1);
@@ -16109,6 +16116,13 @@
assert.strictEqual(over(object), false); 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) { QUnit.test('should provide arguments to predicates', function(assert) {
assert.expect(1); assert.expect(1);
@@ -16204,6 +16218,13 @@
assert.strictEqual(over(object), false); 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) { QUnit.test('should provide arguments to predicates', function(assert) {
assert.expect(1); assert.expect(1);