This package has been deprecated

Author message:

This package is deprecated. Engine optimizations have made it unnecessary.

@btmills/queue

0.1.0 • Public • Published

JavaScript queue

This is a queue implementation for JavaScript with a convenient API that avoids use of the expensive (O(n)) Array.shift() operation.

Usage

var Queue = require('o1queue');

Create a new queue.

var q = new Queue();

Queue up some stuff.

q.enqueue('hello');
q.enqueue('world');

How big is it?

console.log(q.length); // 2

What's at the front?

console.log(q.peek()) // 'hello'

Remove some stuff.

while (q.length > 0) {
	console.log(q.dequeue()) // 'hello', 'world'
}

License

Copyright © 2015 Brandon Mills. All rights reserved. Licensed under the MIT License, the full text of which is available in LICENSE.

Readme

Keywords

Package Sidebar

Install

npm i @btmills/queue

Weekly Downloads

0

Version

0.1.0

License

MIT

Last publish

Collaborators

  • btmills