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

denque

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

denque

The fastest javascript implementation of a double-ended queue. Used by the official Redis, MongoDB, MariaDB & MySQL libraries for Node.js and many other libraries. Maintains compatability with deque.

  • 2.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9.5M
increased by6.32%
Maintainers
1
Weekly downloads
 
Created

What is denque?

The denque npm package is a fast double-ended queue implementation. It is optimized for performance and is useful for situations where you need a queue that allows adding or removing items from both ends.

What are denque's main functionalities?

Adding items

This demonstrates how to add items to the queue. 'push' adds an item to the end of the queue, while 'unshift' adds an item to the beginning.

const Denque = require('denque');
let myQueue = new Denque();
myQueue.push('item1');
myQueue.unshift('item0');

Removing items

This shows how to remove items from the queue. 'pop' removes an item from the end of the queue, and 'shift' removes an item from the beginning.

const removedLast = myQueue.pop();
const removedFirst = myQueue.shift();

Peeking at items

This code sample demonstrates how to peek at items in the queue without removing them. 'peekFront' looks at the first item, and 'peekBack' looks at the last item.

const firstItem = myQueue.peekFront();
const lastItem = myQueue.peekBack();

Other packages similar to denque

Keywords

FAQs

Package last updated on 31 Aug 2021

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