npm.io
1.0.0 • Published 3 years ago

@amaui/queue

Licence
MIT
Version
1.0.0
Deps
2
Size
20 kB
Vulns
0
Weekly
0


onesy logo

onesy 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


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

Keywords