Gathering detailed insights and metrics for yocto-queue
Gathering detailed insights and metrics for yocto-queue
Gathering detailed insights and metrics for yocto-queue
Gathering detailed insights and metrics for yocto-queue
npm install yocto-queue
Typescript
Module System
Min. Node Version
Node Version
NPM Version
99.8
Supply Chain
92.3
Quality
77.2
Maintenance
100
Vulnerability
100
License
JavaScript (94.91%)
TypeScript (5.09%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
396 Stars
15 Commits
26 Forks
6 Watchers
1 Branches
4 Contributors
Updated on Jul 12, 2025
Latest Version
1.2.1
Package Id
yocto-queue@1.2.1
Unpacked Size
7.82 kB
Size
3.12 kB
File Count
5
NPM Version
10.9.2
Node Version
23.6.1
Published on
Mar 22, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Tiny queue data structure
You should use this package instead of an array if you do a lot of Array#push()
and Array#shift()
on large arrays, since Array#shift()
has linear time complexity O(n) while Queue#dequeue()
has constant time complexity O(1). That makes a huge difference for large arrays.
A queue is an ordered list of elements where an element is inserted at the end of the queue and is removed from the front of the queue. A queue works based on the first-in, first-out (FIFO) principle.
1npm install yocto-queue
1import Queue from 'yocto-queue'; 2 3const queue = new Queue(); 4 5queue.enqueue('🦄'); 6queue.enqueue('🌈'); 7 8console.log(queue.size); 9//=> 2 10 11console.log(...queue); 12//=> '🦄 🌈' 13 14console.log(queue.dequeue()); 15//=> '🦄' 16 17console.log(queue.dequeue()); 18//=> '🌈'
queue = new Queue()
The instance is an Iterable
, which means you can iterate over the queue front to back with a “for…of” loop. Using the iterator will not remove the items from the queue. If you want that, use drain()
instead.
You can also use spreading to convert the queue to an array. Don't do this unless you really need to though, since it's slow.
.enqueue(value)
Add a value to the queue.
.dequeue()
Remove the next value in the queue.
Returns the removed value or undefined
if the queue is empty.
.peek()
Get the next value in the queue without removing it.
Returns the value or undefined
if the queue is empty.
.drain()
Returns an iterator that dequeues items as you consume it.
This allows you to empty the queue while processing its items.
If you want to not remove items as you consume it, use the Queue
object as an iterator.
.clear()
Clear the queue.
.size
The size of the queue.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
security policy file detected
Details
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
Found 3/15 approved changesets -- score normalized to 2
Reason
0 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More