Skip to content

onesy-me/queue

Repository files navigation



onesy logo

onesy 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 @onesy/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 OnesyQueue from '@onesy/queue';

  // Make a new queue instance
  const onesyQueue = new OnesyQueue();

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

  onesyQueue.first;
  // 1

  onesyQueue.length;
  // 4

  const value = onesyQueue.pop();

  value;
  // 1

  onesyQueue.first;
  // 2

  onesyQueue.length;
  // 3

Dev

Install

yarn

Test

yarn test

Prod

Build

yarn build