A TypeScript implementation of a min-priority queue data structure, extracted from the data-structure-typed collection. Version 2.6.0 offers a standalone binary heap-based priority queue with a customizable comparator for ordering elements. The package ships TypeScript declarations and supports ESM and CJS via module bundlers. It differentiates itself from built-in JavaScript priority queues by providing a dedicated min-heap with explicit add, poll, and peek methods, making it suitable for scheduling, event simulation, and algorithmic use cases. The library is actively maintained with regular releases.
npm install min-priority-queue-typedNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage: creating a min-priority queue, adding elements, peeking, polling, and using a custom comparator for objects.
Use `new MinPriorityQueue<T>([], { comparator: ... })` to pass options with an empty array.Always provide a comparator function for non-primitive types.
Always check `queue.size > 0` before calling `peek()` or use optional chaining.
Consider migrating to `data-structure-typed` for access to all data structures.
Change to `import { MinPriorityQueue } from 'min-priority-queue-typed'`.Use `new MinPriorityQueue([], { comparator: ... })`.Update to version >=1.0.0 and ensure correct import.
No dependency data recorded yet.