Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/rimbu/core/mod.ts>IndexRange

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
namespace IndexRange
Re-export
import { IndexRange } from "https://deno.land/x/rimbu@1.2.0/core/mod.ts";

Functions

Returns, given the range IndexRange, a normalized tuple containing the start index, and optionally an end index.

Returns, given the range IndexRange, and a target maximum length, the actual index range. This can be one of three options:

  • 'empty': there are no elements within the range
  • 'all': all elements are within the range
  • [start: number, end: number]: an inclusive range of element indices within the given range
type alias IndexRange
Re-export
import { type IndexRange } from "https://deno.land/x/rimbu@1.2.0/core/mod.ts";

A flexible range specification for numeric indices. If a start or end is defined, a tuple can be used where the second item is a boolean indicating whether that end is inclusive or exclusive. An IndexRange can have one of the following forms:

  • { amount: number }
  • { start: number }
  • { start: number, amount: number }
  • { start: number, end: number }
  • { start: number, end: [number, boolean] }
  • { start: [number, boolean] }
  • { start: [number, boolean], amount: number }
  • { start: [number, boolean], end: number }
  • { start: [number, boolean], end: [number, boolean] }
  • { end: number }
  • { end: [number, boolean] }
definition: { amount: number; start?: number | [number, boolean]; end?: undefined; } | Range<number>