Queue
Very simple code Modern code Junior friendly Typescript Made with 💛
yarn add @onesy/queue
- First come, first serve, use cases
- CPU Scheduling
- Memory management
- Website requests handling on the server
- Routers and switches in networking
- etc.
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
Install
yarn
Test
yarn test
Build
yarn build