PriorityQueue is a TypeScript-friendly JavaScript library implementing priority queues with multiple heap variants (BinaryHeap, PairingHeap, SkewHeap). Version 2.1.0 is current; updates are occasional. Key differentiators: supports custom comparators, offers three heap implementations with different performance trade-offs (BinaryHeap for general use, PairingHeap and SkewHeap for fast merge operations), exports ESM and includes TypeScript definitions. Suitable for algorithmic tasks, scheduling, and graph algorithms.
npm install priorityqueueNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage with number and custom object comparators, push, pop, top, and length.
Update imports from 'priorityqueue/lib/BinaryHeap' to 'priorityqueue/BinaryHeap' (unless using moduleResolution 'node', then keep 'lib/').
Provide a comparator function in the options object: new PriorityQueue({ comparator: (a,b) => a - b }).Use pq.merge(otherHeap) for merging heaps.
Use the specific heap class directly: import PairingHeap from 'priorityqueue/PairingHeap'.
Change imports to 'priorityqueue/lib/...' or switch moduleResolution to 'node16' or 'bundler'.
Use import PriorityQueue from 'priorityqueue' in an ESM context.
Import from 'priorityqueue/lib/BinaryHeap' instead, or change moduleResolution to 'node16' or 'bundler'.
No dependency data recorded yet.