A functional, data-oriented priority queue (max-heap) for Node.js, version 0.2.1. Designed to be tiny (~150 lines), pure ES module, and — critically — does not allocate memory at runtime after initial creation. It is a preallocated array-based heap offering queue, dequeue, isEmpty, clear, delete, and list operations. Unlike typical priority queue libraries that allocate dynamically, this one is suited for performance-critical or real-time applications where GC pauses must be avoided. The package is actively maintained and has tests via GitHub Actions.
npm install priority-queueNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Create a priority queue, insert items with priorities, and dequeue them in order of descending priority. Shows that dequeue returns undefined when empty.
Always use PQ.create(maxSize) with a size adequate for your workload.
Pass priority as -value if you need min-heap behavior.
Keep a reference to the item when you queue it, and use that same reference for delete.
Verify arguments: PQ.queue(queueObject, item, priority).
Use: import PQ from 'priority-queue'
Use import syntax or run in an ESM context (e.g., type: 'module' in package.json).
Call PQ.queue(obj, item, priority) instead of obj.queue(item, priority).
No dependency data recorded yet.