npm module for start ended lifo/ fifo, normal js ended lifo/ fifo, double ended queue and semaphore queue implementation
Find the demos in the demos folder
Commonjs Code
var queues = require("queues.js");
var QueueFifo = require("queues.js").QueueLifo;
var QueueLifo = require("queues.js").QueueFifo;
// FIFO BOTTOM QUEUE IMPLEMENTATION
// <== [1,2,3,4] <==
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
// [1,2,3,4] <==
// ==>
var lifo = new QueueLifo();
lifo.enqueue(item);
lifo.add(item);
lifo.push(item);
lifo.insert(item);
lifo.dequeue();
lifo.pop();
lifo.remove();
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").QueueLifo;
var QueueLifo = import("queues.js").QueueFifo;
var fifo = new QueueFifo();
var lifo = new QueueLifo();
const { Base, BaseLowFootprint, AsyncBase, AsyncBaseLowFootPrint } = require("queues.js");
// Base - Persistent Queue
// BaseLowFootprint - Non-Persistent Queue
// Queue - Persistent Queue
// QueueLowFootprint - Non-Persistent Queue
// All LowFootprint names classes / functions are non-persistent queues
const { Queue, QueueLowFootprint, QueueLifo, QueueFifo, QueueLowFootprintLifo, QueueLowFootprintFifo, AsyncQueue, AsyncQueueLowFootprint } = require("queues.js");
const { QueueTop, QueueTopLowFootprint, QueueTopLifo, QueueTopFifo, QueueTopLowFootprintLifo, QueueTopLowFootprintFifo, AsyncQueueTop, AsyncQueueTopLowFootprint } = require("queues.js");
const { Stack, StackLowFootprint, AsyncStack, AsyncStackLowFootprint } = require("queues.js");
const { DoubleEnded, DoubleEndedLowFootprint, AsyncDoubleEnded, AsyncDoubleEndedLowFootprint } = require("queues.js");
const { Semaphore } = require("queues.js");
const { WaitQueue } = require("queues.js");
const { Priority, PriorityLowFootprint, AsyncPriority, AsyncPriorityLowFootprint } = require("queues.js");
const { Circular, AsyncCircular } = require("queues.js");
Contributions, Feature Improvements, Bugs, and Issues are invited. raising an issue