A TypeScript implementation of the bucket queue data structure, optimized for priority-based item management when the priority key space consists of small positive integers. Version 2.1.0 is the latest stable release, actively maintained. It offers extremely fast enqueue and dequeue operations, outperforming heap-based priority queues in benchmarks, making it ideal for algorithms like Dijkstra's. Ships with full TypeScript type definitions and supports both min and max bucket queues.
npm install bucket-priority-queueNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows instantiation with initial items, push, pop, peek, size, and clear operations for both MinBucketQueue and MaxBucketQueue.
Ensure all priorities are integers >= 0.
Use object references carefully; consider using unique identifiers.
If you need to preserve old items, use 'push' individually instead.
Use import { MinBucketQueue } from 'bucket-priority-queue'.Run 'npm install bucket-priority-queue' and ensure 'moduleResolution' is set to 'node' or 'node16' in tsconfig.json.
The error is misleading; priorities are numbers. If using 'Priority' as a type, import it: import type { Priority } from 'bucket-priority-queue'.No dependency data recorded yet.