Socket
Socket
Sign inDemoInstall

fast-fifo

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-fifo

A fast fifo implementation similar to the one powering nextTick in Node.js core


Version published
Weekly downloads
7.8M
increased by6.61%
Maintainers
1
Weekly downloads
 
Created

What is fast-fifo?

The fast-fifo npm package is a high-performance, zero-dependency queue implementation for JavaScript. It is designed to be a fast FIFO (first-in-first-out) queue structure that can be used in various scenarios where queue operations are required, such as task scheduling, event handling, or data processing pipelines.

What are fast-fifo's main functionalities?

Queue Creation

This feature allows for the creation of a new queue instance. The Queue class is imported from the fast-fifo package and instantiated to create a new queue.

const Queue = require('fast-fifo');
const q = new Queue();

Enqueue

This feature is used to add an item to the end of the queue. The push method is called on the queue instance with the item to be added as an argument.

q.push('some data');

Dequeue

This feature is used to remove and return the item at the front of the queue. The shift method is called on the queue instance to dequeue the item.

const item = q.shift();

Peek

This feature allows you to look at the item at the front of the queue without removing it. The head method is called on the queue instance to retrieve the first item.

const firstItem = q.head();

Queue Length

This feature provides the current number of items in the queue. The length property of the queue instance gives the count of items.

const queueLength = q.length;

Other packages similar to fast-fifo

FAQs

Package last updated on 21 Aug 2023

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc