npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

queues.js

v0.0.22

Published

node package for top and bottom plus lifo/ fifo queues, stack, priority queues, double ended queues, circular queues, wait queues, and semaphore queues implementation

Downloads

6

Readme

queues.js

node package for top and bottom plus lifo/ fifo queues, stack, priority queues, double ended queues, circular queues, wait queues (TODO), and semaphore queues (TODO) implementation

Find the demos in the demos folder

APIs queues.js

Commonjs Code

var queues = require("queues.js");

var Queue = require("queues.js").Queue;
var QueueFifo = require("queues.js").QueueFifo;
var QueueLifo = require("queues.js").QueueLifo;

var queue = new Queue();
var fifo = new QueueFifo();
var lifo = new QueueLifo();

ESM Code

import { default as queues, QueueLifo, QueueFifo } as "queues.js";

var fifo = new QueueFifo();
var lifo = new QueueLifo();

ESM or Commonjs Code

var queues = import("queues.js");
var QueueFifo = import("queues.js").QueueFifo;
var QueueLifo = import("queues.js").QueueLifo;

var fifo = new QueueFifo();
var lifo = new QueueLifo();

Bases used

  • Queue - Persistent Queue (stores the queue value at its place - uses a offset)
  • QueueLowFootprint - Non-Persistent Queue (releases the queue value from its place permanently - use value once)
  • All LowFootprint names classes / functions are non-persistent queues

Queue Types

Queue (includes all Base methods)


const { Queue, QueueLowFootprint, QueueLifo, QueueFifo, QueueLowFootprintLifo, QueueLowFootprintFifo, AsyncQueue, AsyncQueueLowFootprint } = require("queues.js");

Queue Bottom Fifo

Queue Bottom Lifo

QueueTop (includes all Base methods)


const { QueueTop, QueueTopLowFootprint, QueueTopLifo, QueueTopFifo, QueueTopLowFootprintLifo, QueueTopLowFootprintFifo, AsyncQueueTop, AsyncQueueTopLowFootprint } = require("queues.js");

Queue Top Fifo

Queue Top Lifo

Stack (includes all Base methods)


const { Stack, StackLowFootprint, AsyncStack, AsyncStackLowFootprint } = require("queues.js");

Stack

Double - Denqueue (includes all Base methods)


const { DoubleEnded, DoubleEndedLowFootprint, AsyncDoubleEnded, AsyncDoubleEndedLowFootprint } = require("queues.js");

Double Ended Queue

Semaphore (includes all Base methods)

In development


const { Semaphore } = require("queues.js");

WaitQueue (includes all Base methods)

In development


const { WaitQueue } = require("queues.js");

Priority Queue (includes all Base methods)


const { Priority, PriorityLowFootprint, AsyncPriority, AsyncPriorityLowFootprint } = require("queues.js");

Priority Queue

Circular Queue (includes all Base methods)

In development - Currently Testing


const { Circular, AsyncCircular } = require("queues.js");

Circular Queue

FIFO BOTTOM QUEUE IMPLEMENTATION

//
// FIFO BOTTOM QUEUE IMPLEMENTATION
// 
//   <==   [1,2,3,4]  <==
//

var queues = require("queues.js");
var QueueFifo = require("queues.js").QueueFifo;

var fifo = new QueueFifo();
fifo.enqueue(item);
fifo.add(item);
fifo.insert(item);
fifo.push(item);

fifo.dequeue();
fifo.shift();
fifo.remove();

LIFO BOTTOM QUEUE IMPLEMENTATION

//
// LIFO BOTTOM QUEUE IMPLEMENTATION
// 
//              <==
//   [1,2,3,4]  
//              ==>
//

var queues = require("queues.js");
var QueueLifo = require("queues.js").QueueLifo;

var lifo = new QueueLifo();
lifo.enqueue(item);
lifo.add(item);
lifo.push(item);
lifo.insert(item);

lifo.dequeue();
lifo.pop();
lifo.remove();

TODO

.todo In Development: Asynchronous Implementation, Semphores, Wait Queues

Contributions

Contributions, Feature Improvements, Bugs, and Issues are invited. raising an issue

License

MIT License