Remove isFlattenableIteratee predicate to resolve regression. [closes #2418]

This commit is contained in:
John-David Dalton
2016-06-13 11:08:05 -07:00
parent adac412f58
commit 9f6d6d7b37
2 changed files with 7 additions and 23 deletions

View File

@@ -4915,7 +4915,7 @@
return rest(function(iteratees) {
iteratees = (iteratees.length == 1 && isArray(iteratees[0]))
? arrayMap(iteratees[0], baseUnary(getIteratee()))
: arrayMap(baseFlatten(iteratees, 1, isFlattenableIteratee), baseUnary(getIteratee()));
: arrayMap(baseFlatten(iteratees, 1), baseUnary(getIteratee()));
return rest(function(args) {
var thisArg = this;
@@ -5821,18 +5821,6 @@
return isArray(value) || isArguments(value);
}
/**
* Checks if `value` is a flattenable array and not a `_.matchesProperty`
* iteratee shorthand.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
*/
function isFlattenableIteratee(value) {
return isArray(value) && !(value.length == 2 && !isFunction(value[0]));
}
/**
* Checks if `value` is a valid array-like index.
*
@@ -9426,11 +9414,7 @@
} else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
iteratees = [iteratees[0]];
}
iteratees = (iteratees.length == 1 && isArray(iteratees[0]))
? iteratees[0]
: baseFlatten(iteratees, 1, isFlattenableIteratee);
return baseOrderBy(collection, iteratees, []);
return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
});
/*------------------------------------------------------------------------*/
@@ -10132,7 +10116,7 @@
var overArgs = rest(function(func, transforms) {
transforms = (transforms.length == 1 && isArray(transforms[0]))
? arrayMap(transforms[0], baseUnary(getIteratee()))
: arrayMap(baseFlatten(transforms, 1, isFlattenableIteratee), baseUnary(getIteratee()));
: arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
var funcsLength = transforms.length;
return rest(function(args) {

View File

@@ -16164,7 +16164,7 @@
QUnit.test('should work with `_.matchesProperty` shorthands', function(assert) {
assert.expect(1);
var over = _.overArgs(fn, ['b', 1], [['a', 1]]);
var over = _.overArgs(fn, [['b', 1], ['a', 1]]);
assert.deepEqual(over({ 'b': 2 }, { 'a': 1 }), [false, true]);
});
@@ -16753,7 +16753,7 @@
QUnit.test('should work with `_.matchesProperty` shorthands', function(assert) {
assert.expect(2);
var over = _.over(['b', 2], [['a', 2]]);
var over = _.over([['b', 2], ['a', 2]]);
assert.deepEqual(over({ 'a': 1, 'b': 2 }), [true, false]);
assert.deepEqual(over({ 'a': 2, 'b': 1 }), [false, true]);
@@ -16847,7 +16847,7 @@
QUnit.test('should work with `_.matchesProperty` shorthands', function(assert) {
assert.expect(2);
var over = _.overEvery(['b', 2], [['a', 1]]);
var over = _.overEvery([['b', 2], ['a', 1]]);
assert.strictEqual(over({ 'a': 1, 'b': 2 }), true);
assert.strictEqual(over({ 'a': 0, 'b': 2 }), false);
@@ -16968,7 +16968,7 @@
QUnit.test('should work with `_.matchesProperty` shorthands', function(assert) {
assert.expect(2);
var over = _.overSome(['a', 1], [['b', 2]]);
var over = _.overSome([['b', 2], ['a', 1]]);
assert.strictEqual(over({ 'a': 0, 'b': 2 }), true);
assert.strictEqual(over({ 'a': 0, 'b': 0 }), false);