
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
@supercharge/queue-datastructure
Advanced tools
A no-dependency, in-memory queue data structure for Node.js and JavaScript
A queue data structure for Node.js and JavaScript.
Installation · Usage · API
Follow @marcuspoehls and @superchargejs for updates!
npm i @supercharge/queue-datastructure
Using the queue data structure is pretty straightforward. The library exposes a Queue
class that you can use to create a queue instance. You can create a queue from existing data or an empty one:
const Queue = require('@supercharge/queue-datastructure')
// create a queue from an existing array
const queue = new Queue([ 1, 2, 3 ])
// or, create a queue from individual items
const queue = new Queue(1, 2, 3)
// or, create an empty queue
const queue = new Queue()
.enqueue(items)
Push new items
to the end of the queue.
queue
.enqueue(1)
.enqueue(2, 3)
.enqueue([ 4, 5, 6])
// Queue: 1, 2, 3, 4, 5, 6
.dequeue()
Remove and return the item which is up for processing. Returns undefined
if the queue is empty.
queue.enqueue(1, 2, 3)
queue.size() // 3
queue.dequeue() // 1
queue.size() // 2
.peek()
Returns the first item without removing it from the queue. Returns undefined
if the queue is empty.
queue.enqueue(1, 2, 3)
queue.peek() // 1
.size()
Returns the number of items in the queue.
queue.size() // 0
queue.enqueue(1, 2)
queue.size() // 2
.isEmpty()
Returns true
if there are no items in the queue, false
otherwise.
queue.isEmpty() // true
queue.enqueue(1)
queue.isEmpty() // false
.isNotEmpty()
Returns true
if there are items in the queue, false
when the queue is empty.
queue.isNotEmpty() // false
queue.enqueue(1)
queue.isNotEmpty() // true
.clear()
Removes all items from the queue.
queue.clear()
queue.size() // 0
git checkout -b my-feature
git commit -am 'Add some feature'
git push origin my-new-feature
MIT © Supercharge
superchargejs.com · GitHub @supercharge · Twitter @superchargejs
2.1.0 - 2020-08-20
ts-jest
main
in package.json
to export the transpiled codetypes
in package.json
to export the types from the transpiled codeindex.js
file which acted as a middleman to export the transpiled codeFAQs
A no-dependency, in-memory queue data structure for Node.js and JavaScript
The npm package @supercharge/queue-datastructure receives a total of 628 weekly downloads. As such, @supercharge/queue-datastructure popularity was classified as not popular.
We found that @supercharge/queue-datastructure demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.