A standalone binary heap-based priority queue with min/max modes, part of the data-structure-typed collection. Version 2.6.0 is the latest stable release, published under a weekly cadence. Ships TypeScript types and supports both ES modules and CommonJS. Differentiators include configurable comparators, heapify static method, clone, DFS traversal, and sort. Lightweight (<5 KB min+gzip) and suitable for scheduling, graph algorithms, and triage systems.
npm install priority-queue-typedNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates PriorityQueue constructor with comparator, dynamic add/poll/peek, MinPriorityQueue shorthand, and static heapify method.
Use import { PriorityQueue } from 'priority-queue-typed'; instead of require or default import.new PriorityQueue({ comparator: (a,b) => b - a })new PriorityQueue({ nodes: [1,2,3], comparator: ... })Always pass a comparator function in the options object.
Use pq.add(element) to insert.
Switch to import syntax or use dynamic import: const { PriorityQueue } = await import('priority-queue-typed');Pass comparator: (a,b) => a - b for min-heap or b - a for max-heap.
Use pq.add(value) or pq.offer(value) (offer is an alias).
No dependency data recorded yet.