The type of elements in the heap.
Readonly
capacityThe maximum number of elements the collection can hold.
If the collection is unbounded, this will be Infinity
.
Protected
Readonly
dataReadonly
isRemoves all elements from the collection.
Returns the number of elements in the collection.
Removes and returns the root item of the heap.
The root item of the heap, or undefined
if the heap is empty.
Replaces all the item matching the given predicate in the collection with a new item.
An iterable of the replaced items.
Replaces the first occurence of the item matching the given predicate in the collection with a new item.
true
if the item was found and replaced, false
otherwise.
Returns the root item of the heap without removing it.
The root item of the heap, or undefined
if the heap is empty.
Same as insert
, but waits for capacity if the operation would exceed it.
Optional
signal: null | AbortSignalOptional abort signal to cancel the operation.
A binary heap implementation.