bisectRight
bisectRight<
T,V>(items,value,compare):number
Defined in: ordered/bisect-right.ts:16
Finds the rightmost index in items where value could be inserted while
keeping items sorted — after any existing element considered equivalent to
it.
O(log n) via binary search. items must already be sorted by compare.
Type Parameters
Section titled “Type Parameters”T
V = T
Parameters
Section titled “Parameters”readonly T[]
Array sorted ascending by compare.
V
The value to find an insertion point for.
compare
Section titled “compare”(item, value) => number
Orders an item against value: negative if the item precedes
it, positive if the item follows it, 0 if equivalent.
Returns
Section titled “Returns”number
The rightmost valid insertion index, in [0, items.length].