queuejs

1.0.0 • Public • Published

queue.js

Build Status

A simple queue data structure for Node.js.

Installation

npm install queuejs

Example

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

API

Queue()

Initializes a new empty Queue.

Queue#deq()

Dequeues the top element of the queue. Throws an Error when the queue is empty.

Queue#enq(element)

Enqueues the element at the end of the queue and returns its new size.

Queue#isEmpty()

Returns whether the queue is empty or not.

Queue#peek()

Peeks at the top element of the queue. Throws an Error when the queue is empty.

Queue#size()

Returns the size of the queue.

Testing

npm install
npm test

Licence

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    0
  • 0.1.0
    28
  • 0.0.2
    1
  • 0.0.1
    1

Package Sidebar

Install

npm i queuejs

Weekly Downloads

30

Version

1.0.0

License

MIT

Unpacked Size

5.44 kB

Total Files

6

Last publish

Collaborators

  • janogonzalez