Skip to content

minPriorityQueue<K, V>(keyOrder, entries?): BinaryPriorityQueue<K, V>

Defined in: packages/heap/src/priority-queue.ts:646

Create a min priority queue over a binary heap: the entry with the smallest key per keyOrder is at the root, and pop extracts in ascending key order.

K

V

Order<K>

Total ordering over the keys.

Iterable<readonly [K, V], any, any>

Optional initial [key, value] pairs, in iteration order.

BinaryPriorityQueue<K, V>

const pq = minPriorityQueue(numberOrder, [[5, 'a'], [1, 'b'], [3, 'c']])
pq.peek() // 'b'
pq.peekEntry() // [1, 'b']

With code DUPLICATE_VALUE when entries carries one value twice.