A lightweight JavaScript queue data structure with O(1) time complexity for all operations. Version 1.1.8, stable. Provides a simple, minimal API (enqueue, dequeue, peek, isEmpty, size, clear) and custom console.log formatting for Queue instances. Unlike many other queue implementations that use arrays (O(n) dequeue), this library uses a linked-list-based approach for guaranteed constant-time performance. Suitable for both Node.js and browser environments. No dependencies.
npm install queue-listNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates creating a Queue, enqueuing multiple elements, peeking, dequeuing, and clearing, with all O(1) operations.
Use queue.toArray() if available, or iterate manually. The README mentions custom console.log formatting but it may not work as expected in all environments.
Create a global .d.ts file: declare module 'queue-list' { export default class Queue<T = any> { ... } }Chain enqueue calls: queue.enqueue(1).enqueue(2); or assign: const q = queue.enqueue(1);
Use `const Queue = require('queue-list').default;` or `import Queue from 'queue-list';` in an ESM environment.Ensure you create an instance: `const queue = new Queue();` then call queue.enqueue().
Check that you imported Queue as a class and created an instance. Use `const queue = new Queue();`.
No dependency data recorded yet.