Skip to content

IntervalStep

IntervalStep<T> = object

Defined in: interval/interval-step.ts:19

The successor and predecessor of a bound, for the operations that have to name a point just outside an interval.

Complementing or subtracting closed intervals cannot be done without one. Removing [3, 5] from [0, 10] leaves everything up to but excluding 3 and everything after but excluding 5, and a closed interval can only say that as [0, 2] and [6, 10] — so the algorithm needs 2 from 3 and 6 from 5, which no comparator can supply.

That makes these operations meaningful only over a discrete bound type. Over the reals the answer is genuinely not expressible as closed intervals, and no IntervalStep can be written for them.

A type with a step is also adjacency-aware, so a caller passing one here usually wants (end, next) => compare(step.next(end), next) === 0 as mergeIntervals’ isAdjacent.

T

next(value): T

Defined in: interval/interval-step.ts:21

The smallest value strictly greater than value.

T

T


previous(value): T

Defined in: interval/interval-step.ts:23

The largest value strictly less than value.

T

T