(4.17) Short circuit sortedIndexBy methods for empty arrays (#4497)

This commit is contained in:
Graeme Yeates
2019-10-04 13:23:55 -04:00
committed by John-David Dalton
parent b281ddecc4
commit 602cc3f03d
2 changed files with 17 additions and 4 deletions

View File

@@ -20998,6 +20998,16 @@
assert.strictEqual(actual, 1);
});
QUnit.test('`_.' + methodName + '` should avoid calling iteratee when length is 0', function(assert) {
var objects = [],
iteratee = function() {
throw new Error;
},
actual = func(objects, { 'x': 50 }, iteratee);
assert.strictEqual(actual, 0);
});
QUnit.test('`_.' + methodName + '` should support arrays larger than `MAX_ARRAY_LENGTH / 2`', function(assert) {
assert.expect(12);