File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed
Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 41294129 * into `array`.
41304130 */
41314131 function baseSortedIndexBy(array, value, iteratee, retHighest) {
4132- value = iteratee(value);
4133-
41344132 var low = 0,
4135- high = array == null ? 0 : array.length,
4136- valIsNaN = value !== value,
4133+ high = array == null ? 0 : array.length;
4134+ if (high === 0) {
4135+ return 0;
4136+ }
4137+
4138+ value = iteratee(value);
4139+ var valIsNaN = value !== value,
41374140 valIsNull = value === null,
41384141 valIsSymbol = isSymbol(value),
41394142 valIsUndefined = value === undefined;
Original file line number Diff line number Diff line change 2099820998 assert.strictEqual(actual, 1);
2099920999 });
2100021000
21001+ QUnit.test('`_.' + methodName + '` should avoid calling iteratee when length is 0', function(assert) {
21002+ var objects = [],
21003+ iteratee = function() {
21004+ throw new Error;
21005+ },
21006+ actual = func(objects, { 'x': 50 }, iteratee);
21007+
21008+ assert.strictEqual(actual, 0);
21009+ });
21010+
2100121011 QUnit.test('`_.' + methodName + '` should support arrays larger than `MAX_ARRAY_LENGTH / 2`', function(assert) {
2100221012 assert.expect(12);
2100321013
You can’t perform that action at this time.
0
0 commit comments