You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

fifo

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fifo

FIFO queue

2.0.0
Source
npmnpm
Version published
Maintainers
1
Created
Source

FIFO

Javascript FIFO queue implemented using a double linked-list

npm install fifo

build status

Usage is simple

var fifo = require('fifo')();

fifo.push('hello');
fifo.push('world');

console.log(fifo.first()); // prints hello
console.log(fifo.last());  // prints world

console.log(fifo.shift()); // prints hello
console.log(fifo.shift()); // prints world

var node = fifo.push('meh');

fifo.remove(node);     // remove 'meh' from the stack
fifo.unshift('hello'); // insert at the beginning

fifo uses a linked list behind the scene so push, shift, unshift, and remove all run in O(1)

License

MIT

Keywords

queue

FAQs

Package last updated on 14 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts