A standalone Max Priority Queue data structure with TypeScript support, implemented as part of the data-structure-typed collection. Version 2.6.0 provides a minified bundle of ~5.3 KB. It uses a binary heap and offers typical operations like add, poll, peek, and toArray. The package is actively maintained alongside the larger data-structure-typed library, which includes many other data structures. Key differentiators include a focus on TypeScript-first design, custom comparator support, and detailed API documentation. The package follows a regular release cadence with weekly releases.
npm install max-priority-queue-typedNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a max priority queue with a custom comparator and demonstrates adding, peeking, and polling elements.
Use new MaxPriorityQueue<T>(initialElements?, options?) where options contains comparator and other settings.
Replace calls to .push(element) with .add(element) and .pop() with .poll().
Use a comparator that returns a number, e.g., (a, b) => a - b for min-heap or (a, b) => b - a for max-heap.
Replace import MaxPriorityQueue from 'max-priority-queue-typed' with import { MaxPriorityQueue } from 'max-priority-queue-typed'.Install the correct package: npm install max-priority-queue-typed
Use the correct method name: .poll() instead of .pop().
No dependency data recorded yet.