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

namastey-double-ended-queue

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

namastey-double-ended-queue

A JavaScript package that implements the Double-ended Queue (Deque) data structure with various important methods for efficient data handling.

  • 1.0.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
0
Weekly downloads
 
Created
Source

namastey-double-ended-queue

Brief Description

namastey-double-ended-queue is a JavaScript package that implements a Double-ended Queue (Deque) data structure. It provides methods to efficiently add and remove elements from both ends of the queue.

Features

  • addFront(value): Adds an element to the front of the deque.
  • addRear(value): Adds an element to the rear of the deque.
  • removeFront(): Removes and returns an element from the front of the deque.
  • removeRear(): Removes and returns an element from the rear of the deque.
  • peekFront(): Peeks at the front element without removing it.
  • peekRear(): Peeks at the rear element without removing it.
  • isEmpty(): Checks if the deque is empty.
  • getSize(): Returns the number of elements in the deque.

Installations

To install the package globally, run:

npm install -g namastey-double-ended-queue

Examples

const Deque = require('namastey-double-ended-queue');

const deque = new Deque();

deque.addFront(10);
deque.addRear(20);
console.log(deque.peekFront()); // Output: 10
console.log(deque.peekRear()); // Output: 20

deque.addFront(5);
console.log(deque.removeRear()); // Output: 20
console.log(deque.removeFront()); // Output: 5
console.log(deque.getSize()); // Output: 1

Keywords

FAQs

Package last updated on 27 Aug 2024

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