avkrash-queue
v0.3.0
Published
Dynamical data structure - Queue
Downloads
3
Readme
JS Test Task #2: Queue (avkrash-queue)
Queue is dynamical data structure add-on to JS that allows you to create queues and work with them.
Module description
Initializing the list
const Queue = require('avkrash-queue');
var queue = new Queue();
Adding elements to the queue
queue.enqueue(15);
queue.enqueue({'foo':1,'bar':'tender'});
See first element of queue
queue.peek(); //returns '15'
queue.peek(); //returns '15'
Take first element from queue and show it value
queue.dequeue(); //returns '15' and removes first element
queue.peek(); //returns "{'foo':1,'bar':'tender'}"
queue.dequeue(); //returns "{'foo':1,'bar':'tender'}" and removes last element from queue
Check if queue is empty
queue.isEmprty(); //returns 'true'
Getting started
Install
npm install avkrash-queue
Running tests
npm test
P.S.: for additional info see JSDocs