0.0.2 • Published 4 years ago
@juancwu/q-obj v0.0.2
Object Based Queue
Object based queue implementation in javascript.
Get Started
npm install @juancwu/q-obj
const Queue = require("@juancwu/q-obj");
const q = new Queue();
// push values into Queue
// ...
Queue API
q = new Queue();
Creates a new Queue
instance.
q.push(item);
Push an item into Queue
. Big-O analysis: O(1).
q.pop();
Pop the first item in Queue
. Big-O analysis: O(1).
q.toString();
Generates a string representation of the Queue
.
q.length();
Return the number of items in Queue
.
for (let i of q) { ... }
Iterates through the items in Queue
from first to last.
for await (let i of q) { ... }
Iterates through the items in Queue
from first to last asynchronously.