UNPKG

queue-lit

Version:

queue-lit is a tiny queue data structure in case you `Array#push()` or `Array#shift()` on large arrays very often

30 lines (28 loc) 661 B
/** * A simple queue implementation that follows the FIFO (First In, First Out) * principle. */ export declare class Queue { private head; private tail; private _size; constructor(); /** * Removes all elements from the queue. */ clear(): void; /** * Adds a new element to the queue. */ push(value: unknown): number; /** * Removes and returns the first element in the queue. */ pop(): unknown; /** * Returns the number of elements in the queue. */ get size(): number; [Symbol.iterator](): Generator<unknown, void, unknown>; } export { }