Options
All
  • Public
  • Public/Protected
  • All
Menu

A range is a well-defined sequence of elements that are part of a collection.

Traversing a range that is being mutated results is undefined behavior (with some exceptions). To be safe, you need to manually make a copy of the elements in the range before adding or removing elements.

Type parameters

  • T

Hierarchy

  • Range

Index

Properties

Optional Readonly reversed

reversed: boolean

Indicates whether this range will traverse its elements in reverse order.

see

reverse

Readonly size

size: number

Get how many elements are in this range.

⚠️ This might be an expensive operation, so make sure to cache it if you need frequent access to it.

Methods

[Symbol.iterator]

  • [Symbol.iterator](): IterableIterator<T>
  • Get an iterator that sequences the elements contained in this range.

    Returns IterableIterator<T>

cursors

  • cursors(): IterableIterator<Cursor<T>>
  • Return an iterator that provides cursors to inspect or delete the given element.

    see

    Cursor

    Returns IterableIterator<Cursor<T>>

Optional filter

  • filter(pred: (element: Cursor<T>) => boolean): Range<T>
  • Filters this range using the given predicate. Iterating over the newly returned range will cause all cursors that did not match the predicate to be omitted.

    Parameters

    • pred: (element: Cursor<T>) => boolean
        • (element: Cursor<T>): boolean
        • Parameters

          Returns boolean

    Returns Range<T>

Optional reverse

  • Reverse the order of the elements that would be generated with the iterator.

    Reversing a range is only possible when the order of the elements is well-defined, such as the elements in a list or a tree-based dictionary.

    Returns Range<T>

Legend

  • Property
  • Method
  • Accessor
  • Property
  • Method
  • Inherited property
  • Inherited method

Generated using TypeDoc