A super simple queue built on an array. The main advantage of using this is that dequeue() never returns undefined, allowing to write type-checked code like this:
dequeue()
undefined
const queue = new Queue(1, 2, 3); // type: Queue<number> while (!queue.isEmpty()) { const elem = queue.dequeue(); // type: number }
queue element
Generated using TypeDoc
A super simple queue built on an array. The main advantage of using this is that
dequeue()
never returnsundefined
, allowing to write type-checked code like this: