A simple queue data structure for Node.js.
npm install queuejs
var Queue = require('queuejs');
var queue = new Queue();
queue.enq(10);
queue.enq(5);
queue.size(); // 2
queue.peek(); // 10
queue.deq(); // 10
queue.size(); // 1
Initializes a new empty Queue
.
Dequeues the top element of the queue.
Throws an Error
when the queue is empty.
Enqueues the element
at the end of the queue and returns its new size.
Returns whether the queue is empty or not.
Peeks at the top element of the queue.
Throws an Error
when the queue is empty.
Returns the size of the queue.
npm install
npm test
MIT