Socket
Socket
Sign inDemoInstall

fifo

Package Overview
Dependencies
0
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    fifo

FIFO queue


Version published
Maintainers
1
Install size
2.31 kB
Created

Readme

Source

FIFO

Javascript FIFO queue implemented using a double linked-list

npm install fifo

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

FAQs

Last updated on 21 Sep 2013

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc