A lightweight, TypeScript-friendly queue implementation using a linked list, providing O(1) enqueue and dequeue operations. Compared to native arrays, it avoids the O(n) cost of Array.shift, making it ideal for high-throughput FIFO use cases. v1.0.3 is the current stable release. Ships TypeScript declarations and supports both ESM and CommonJS via conditional exports. Minimal API surface (enqueue, dequeue, clear, size, isEmpty, head, tail) with no dependencies. Bundle size gzipped < 1KB.
npm install tiny-linked-queueNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a queue, enqueues elements, checks properties, dequeues, and clears. Demonstrates generic typing and all main methods.
Update import to use default import: import Queue from 'tiny-linked-queue'
Treat head and tail as read-only. Do not mutate returned values.
Always check isEmpty before calling dequeue, or handle undefined returns explicitly.
Do not pass arguments to new Queue().
Use import Queue from 'tiny-linked-queue' instead of import { Queue } from 'tiny-linked-queue'.Use import Queue from 'tiny-linked-queue' to get the class constructor.
Upgrade TypeScript to >=3.8 or set useDefineForClassFields: true in tsconfig.json.
No dependency data recorded yet.