Skip to content

amaui-org/amaui-queue

Repository files navigation



amaui logo

amaui Queue

Queue


MIT license     Production ready     UMD 1.5kb gzipped     100% test cov     Browser and Nodejs

Very simple code     Modern code     Junior friendly     Typescript     Made with 💛


Getting started

Add

yarn add @amaui/queue

Use cases

  • First come, first serve, use cases
  • CPU Scheduling
  • Memory management
  • Website requests handling on the server
  • Routers and switches in networking
  • etc.

Use

  import AmauiQueue from '@amaui/queue';

  // Make a new queue instance
  const amauiQueue = new AmauiQueue();

  // Add values
  amauiQueue.push(1, 2, 3, 4);

  amauiQueue.first;
  // 1

  amauiQueue.length;
  // 4

  const value = amauiQueue.pop();

  value;
  // 1

  amauiQueue.first;
  // 2

  amauiQueue.length;
  // 3

Dev

Install

yarn

Test

yarn test

Prod

Build

yarn build