New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

fastqueuejs

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

fastqueuejs

simple minimal fast javascript queue

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

Javascript Fast Queue

Fast implementation of Queue in javascript using es6 classes and arrays.
An offset pointer to the first element in the queue is used for performance reasons; at each dequeue the pointer is updated.
dequeued element are still in the internal array, the array is going to be resized when the quantity of dequeued elements crosses a threshold parameter.\n

/*The default threshold parameter is 1024 it can be changed during instantiation:*/
let queue = new FastQueueJs(2048);
/*or at run time*/
queue.setLimit(128);

Dependencies

no dependencies, works with commonJs, amd, or browser global

Usage Examples

let queue = new FastQueueJs();

queue.enqueue('A');

queue.enqueueMany(['B']);
queue.enqueueMany(['R','A','C','A','D']);
queue.getLength(); //7

queue.dequeue();\\'A'

queue.dequeueMany(3);//['B','R','A']
queue.getLength(); //3

queue.isEmpty();//false

queue.peek();//'C'
queue.getLength();//3
queue.peek(2);//['C','A']
queue.getLength();//3

queue.last();//'D'
queue.getLength();//3
queue.last(2);//['D','A']
queue.getLength();//3

queue.flush();//['C','A','D']
queue.getLength();//0
/*flush() also removes all previously dequeued element reducin internal array size to zero*/

Keywords

queue

FAQs

Package last updated on 22 Oct 2016

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