Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

circular-queue

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

circular-queue

A lightweight circular queue

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

CircularQueue

A lightweight circular queue, useful for situations where losing stale data is preferable to unchecked memory growth.

Build
Status

Installation

Clone this repository:

$ npm install circular-queue

Now, instantiate a queue with a fixed maximum size:

var CircularQueue = require('circular-queue');
var queue = new CircularQueue(10);

...offer it some items:

queue.offer('one');
queue.offer('two');
queue.offer('three');

...and peek at or poll them from the queue:

queue.peek(); // 'one'
queue.poll(); // 'one'
queue.peek(); // 'two'

Events

Instances of CircularQueue will emit:

  • 'evict' - when stale items are evicted from the queue

Testing

Lint and run test suite:

$ npm test

License

MIT

Keywords

FAQs

Package last updated on 18 Aug 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

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