New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dl-queue-ts

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dl-queue-ts

A queue data-structure implementation for TypeScript.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

Queue Data-Structure for TypeScript

This is a queue data-structure implementation for TypeScript using a doubly linked-list from the package dl-doubly-linked-list version 1.0.3 or greater.

Installation

npm install dl-queue-ts

API

Constructor

let q : Queue<T> = new Queue();

Properties

NameTypeDescription
lengthnumberNumber of elements in the queue.

Methods

NameParamTypeDescription
clearnoneEmpties the queue.
peekindexnumberReturns the element stored at the index position. Throws exception if index is out of bounds.
popnonePops the top most emlement in the queue.
pushelementTPushes an element of type T (generic) into the queue.

Documentation

Please refer to doc/index.html for the complete documentation and API reference. The documentation for this project was generated using Compodoc.

Demo

let q : Queue<number> = new Queue();

// Pushes elements into the queue
for(let i=0; i<10; i++) {
    q.push(i*3);
}

// Gets the elements in an array
let nums : Array<number|null> = queue.toArray();

// Pops an element from the queue
let n : number = q.pop();

// Peek into the array
n = q.peek(3);

// Throws an exception for out of bounds for index
n = q.peek(33);

// Empties the array
q.clear();

Keywords

FAQs

Package last updated on 28 Jul 2019

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