Skip to content

IHeap

Defined in: packages/data/src/heap/iheap.ts:11

Interface representing a heap data type.

T extends DefinedValue = DefinedValue

The type of elements in the heap. Anything except undefined, which means “no element”.

readonly precedes: OrderPredicate<T>

Defined in: packages/data/src/heap/iheap.ts:15

Strict weak ordering: precedes(a, b) is true when a outranks b.

[iterator](): Iterator<T, any, any>

Defined in: node_modules/.store/typescript-npm-6.0.3-585eecd158/package/lib/lib.es2015.iterable.d.ts:47

Iterator<T, any, any>

ICollection.[iterator]


clear(): void

Defined in: packages/data/src/collection/icollection.ts:23

Removes all elements from the collection.

void

ICollection.clear


count(): number

Defined in: packages/data/src/collection/icollection.ts:20

The number of elements in the collection.

A method, not a getter: its async counterpart needs a round trip to the backing store, and a member must have the same shape in both.

number

ICollection.count


extract(): T | undefined

Defined in: packages/data/src/heap/iheap.ts:36

Removes and returns the root item of the heap.

T | undefined

The root item of the heap, or undefined if the heap is empty.


extractAndInsert(item): T | undefined

Defined in: packages/data/src/heap/iheap.ts:51

Extracts the root item from the heap and inserts a new item in one operation.

T

The item to replace.

T | undefined


insert(item): void

Defined in: packages/data/src/heap/iheap.ts:22

Inserts an item into the heap.

T

The item to insert.

void


insertAll(items): void

Defined in: packages/data/src/heap/iheap.ts:29

Inserts every item into the heap.

readonly T[]

The items to insert.

void


insertAndExtract(item): T | undefined

Defined in: packages/data/src/heap/iheap.ts:59

Inserts an item into the heap and then extracts and returns the root item in one operation.

T

The item to insert and extract.

T | undefined


peek(): T | undefined

Defined in: packages/data/src/heap/iheap.ts:43

Returns the root item of the heap without removing it.

T | undefined

The root item of the heap, or undefined if the heap is empty.