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
.
Removes all elements from the collection.
Concatenates the given items to the end of the collection and returns an iterator over the merged items.
This method does not mutate the original collection.
The items to merge.
An iterator of the merged items.
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.
Inserts one or more items into the heap.
The items to insert.
Removes all the items matching the given predicate from the collection.
An iterable of the removed items.
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.
Interface representing a heap data type.