* Performs a binary search of `array` to determine the index at which `value` * should be inserted into `array` in order to maintain its sort order. * * @private * @param {Array} array The sorted array to inspect. * @param {*} value The value to evaluate. * @param {bool
(array, value, retHighest)
| 4345 | * into `array`. |
| 4346 | */ |
| 4347 | function binaryIndex(array, value, retHighest) { |
| 4348 | var low = 0, |
| 4349 | high = array ? array.length : low; |
| 4350 | |
| 4351 | if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) { |
| 4352 | while (low < high) { |
| 4353 | var mid = (low + high) >>> 1, |
| 4354 | computed = array[mid]; |
| 4355 | |
| 4356 | if (retHighest ? (computed <= value) : (computed < value)) { |
| 4357 | low = mid + 1; |
| 4358 | } else { |
| 4359 | high = mid; |
| 4360 | } |
| 4361 | } |
| 4362 | return high; |
| 4363 | } |
| 4364 | return binaryIndexBy(array, value, identity, retHighest); |
| 4365 | } |
| 4366 | |
| 4367 | /** |
| 4368 | * This function is like `binaryIndex` except that it invokes `iteratee` for |
no test coverage detected