A sorted queue implementation based on an array-backed binary heap. Version 0.4.4 is the current stable release, but the package is in maintenance mode with no new features accepted. It is designed for Node.js >= 22 and ships TypeScript types. Key differentiators: items can be removed by reference (via item.pop()), supports custom comparator functions, and operates in O(log n) time for push/pop. It is ESM-only and lightweight with no dependencies.
npm install sorted-queueNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage: creating a sorted queue, push/pop/peek/empty, custom comparator, and removing items by reference.
Upgrade Node.js to version 22 or later.
Use import syntax or dynamic import in CommonJS.
Consider alternative packages if new features are needed.
Use the returned item object to remove an arbitrary element from the queue.
Check with empty() or ensure queue is not empty before calling pop/peek.
Do not mutate pushed objects expecting re-sort; remove and re-insert.
Use import { SortedQueue } from 'sorted-queue' or dynamic import.Use import { SortedQueue } from 'sorted-queue' (curly braces).Instantiate: const queue = new SortedQueue();
Upgrade Node.js to >=22 or set NODE_OPTIONS=--openssl-legacy-provider (temporary).
No dependency data recorded yet.