Element type stored in the array.
Sorted array to search.
Numeric value to locate.
Projects each element to its comparable numeric value.
The greatest matching lower-bound index, or -1 before the first
element.
This is useful for locating the lower bound segment of a half-open range
sequence such as [array[i], array[i + 1]). The array must already be
sorted in ascending order by the callback value. When searchValue is lower
than the first projected value, the function returns -1.
const dataList = [
{ value: 0 },
{ value: 100 },
{ value: 300 },
{ value: 700 },
];
binarySearchInRange(dataList, 125, (data) => data.value);
// => 1
Finds the greatest index whose projected numeric value is less than or equal to
searchValue.