mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Allow over, overEvery, and overSome to accept matchesProperty shorthands. [closes #2193]
This commit is contained in:
@@ -164,6 +164,10 @@ exports.methodRearg = {
|
||||
exports.methodSpread = {
|
||||
'invokeArgs': 2,
|
||||
'invokeArgsMap': 2,
|
||||
'over': 0,
|
||||
'overArgs': 1,
|
||||
'overEvery': 0,
|
||||
'overSome': 0,
|
||||
'partial': 1,
|
||||
'partialRight': 1,
|
||||
'without': 1
|
||||
@@ -263,6 +267,7 @@ exports.skipRearg = {
|
||||
'matchesProperty': true,
|
||||
'merge': true,
|
||||
'multiply': true,
|
||||
'overArgs': true,
|
||||
'partial': true,
|
||||
'partialRight': true,
|
||||
'random': true,
|
||||
|
||||
12
lodash.js
12
lodash.js
@@ -4607,7 +4607,7 @@
|
||||
*/
|
||||
function createOver(arrayFunc) {
|
||||
return rest(function(iteratees) {
|
||||
iteratees = arrayMap(baseFlatten(iteratees, 1), getIteratee());
|
||||
iteratees = arrayMap(iteratees, getIteratee());
|
||||
return rest(function(args) {
|
||||
var thisArg = this;
|
||||
return arrayFunc(iteratees, function(iteratee) {
|
||||
@@ -9548,7 +9548,7 @@
|
||||
* @memberOf _
|
||||
* @category Function
|
||||
* @param {Function} func The function to wrap.
|
||||
* @param {...(Function|Function[])} [transforms] The functions to transform
|
||||
* @param {...Function} [transforms] The functions to transform
|
||||
* arguments, specified individually or in arrays.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @example
|
||||
@@ -9572,7 +9572,7 @@
|
||||
* // => [100, 10]
|
||||
*/
|
||||
var overArgs = rest(function(func, transforms) {
|
||||
transforms = arrayMap(baseFlatten(transforms, 1), getIteratee());
|
||||
transforms = arrayMap(transforms, getIteratee());
|
||||
|
||||
var funcsLength = transforms.length;
|
||||
return rest(function(args) {
|
||||
@@ -14644,7 +14644,7 @@
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Util
|
||||
* @param {...(Function|Function[])} iteratees The iteratees to invoke.
|
||||
* @param {...Function} iteratees The iteratees to invoke.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @example
|
||||
*
|
||||
@@ -14663,7 +14663,7 @@
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Util
|
||||
* @param {...(Function|Function[])} predicates The predicates to check.
|
||||
* @param {...Function} predicates The predicates to check.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @example
|
||||
*
|
||||
@@ -14688,7 +14688,7 @@
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Util
|
||||
* @param {...(Function|Function[])} predicates The predicates to check.
|
||||
* @param {...Function} predicates The predicates to check.
|
||||
* @returns {Function} Returns the new function.
|
||||
* @example
|
||||
*
|
||||
|
||||
21
test/test.js
21
test/test.js
@@ -15564,13 +15564,6 @@
|
||||
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);
|
||||
|
||||
@@ -16097,13 +16090,6 @@
|
||||
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);
|
||||
|
||||
@@ -16199,13 +16185,6 @@
|
||||
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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user