mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 10:07:48 +00:00
Short circuit sortedIndexBy methods for empty arrays (#4496)
This commit is contained in:
committed by
John-David Dalton
parent
898b378f06
commit
23286d6428
@@ -18,10 +18,14 @@ const MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1
|
||||
* into `array`.
|
||||
*/
|
||||
function baseSortedIndexBy(array, value, iteratee, retHighest) {
|
||||
value = iteratee(value)
|
||||
|
||||
let low = 0
|
||||
let high = array == null ? 0 : array.length
|
||||
if (high == 0) {
|
||||
return 0
|
||||
}
|
||||
|
||||
value = iteratee(value)
|
||||
|
||||
const valIsNaN = value !== value
|
||||
const valIsNull = value === null
|
||||
const valIsSymbol = isSymbol(value)
|
||||
|
||||
Reference in New Issue
Block a user