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

queuejs

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

queuejs

a simple queue data structure

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

queue.js

Build Status

A simple queue data structure for Node.js.

Installation

npm install queuejs

Example

var Queue = require('queuejs');

var queue = new Queue();

queue.enq(10);
queue.enq(5);
queue.size(); // 2
queue.peek(); // 10
queue.deq(); // 10
queue.size(); // 1

API

Queue()

Initializes a new empty Queue.

Queue#deq()

Dequeues the top element of the queue. Throws an Error when the queue is empty.

Queue#enq(element)

Enqueues the element at the end of the queue and returns its new size.

Queue#isEmpty()

Returns whether the queue is empty or not.

Queue#peek()

Peeks at the top element of the queue. Throws an Error when the queue is empty.

Queue#size()

Returns the size of the queue.

Testing

npm install
npm test

Licence

MIT

Keywords

FAQs

Package last updated on 15 May 2020

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