A high-performance, singly linked list queue for objects that also acts as a Set. Designed for Node.js >=7.6.0, it provides O(1) operations for enqueue, dequeue, has, getNext, and delete. Entries must be reference types and are tagged with a private Symbol. The queue is iterable but not safe to modify during iteration. Version 1.0.1 is stable but has known memory leak risks if not cleared. Lightweight with zero dependencies and TypeScript definitions included.
npm install object-queueNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates creating a queue, enqueuing two objects, checking size and membership, dequeuing, and clearing. Shows TypeScript generics usage.
Collect all items in an array first (e.g., using toArray()) and then modify the queue outside the iteration.
Wrap primitives in an object: queue.enqueue({ key: value }).Always call clear() or dequeue every element when the queue is no longer needed.
Ensure entries are not frozen (Object.isFrozen) and are plain objects.
Wrap the primitive in an object: queue.enqueue({ value: 'string' })Do not freeze or seal entries before enqueuing, or use a different queue implementation.
Use queue.toArray() or iterate via for...of (the queue is iterable).
No dependency data recorded yet.