PriorityQueue TypeScript

JSON →
library 2.0.3 ·javascript
verified Jun 7, 2026

A priority queue (binary heap) implementation in TypeScript with full type support. The constructor accepts an initial capacity and a custom comparator function, defaulting to max-heap. It supports add, poll, peek, contains, clear, toArray, iterable protocol, and dynamic resizing. Version 2.0.3 is the latest stable release; the package is actively maintained. Key differentiators: simple API, TypeScript-first, no runtime dependencies, supports ESM and CJS via CommonJS. Suitable for algorithmic tasks, stream processing, or any in-memory sorting needs.