Primitives / foldkit-primitives/state

range

function · packages/primitives/src/state/range.ts:8

function range(start: number, end: number, step?: number): ReadonlyArray<number>

A numeric range as an array: range(1, 4) is [1, 2, 3], inclusive of the start and exclusive of the end, like Array.from length math. The pagination companion: range(1, (pageCount(model) ?? 0) + 1) is the page list. A zero or non-finite step would loop forever, so it throws, naming the caller — like History's capacity check.