isInSortedIntervals
isInSortedIntervals<
T>(ranges,value,compare):boolean
Defined in: interval/is-in-sorted-intervals.ts:19
Tests whether value falls within any of the given sorted, disjoint ranges,
each represented as a pair of inclusive bounds in a flat array.
Finds the candidate range the same way bisectRight finds an insertion point
(rightmost range whose start is at or before value), then checks value
against that range’s end.
Complexity: O(log n) in the number of ranges (ranges.length / 2).
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”ranges
Section titled “ranges”readonly T[]
Flat, sorted, non-overlapping [start, end, ...] pairs.
T
The value to test for membership.
compare
Section titled “compare”Comparator<T>
Total order between two T values.
Returns
Section titled “Returns”boolean