npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

queue-holder

v1.1.0

Published

Nice queue holder

Readme

QueueHolder

Asynchronous queue

Install

npm i queue-holder

Exmaple #1

const QueueHolder = require('queue-holder');
const queue = new QueueHolder();

async function doSome(index, sleep = false) {
    await queue.hold(); // hold our queue

    if (sleep) {
        console.log(`job[${index}] with sleep started`);
        await queue.sleep(0.5); // sleep for 0.5 seconds
        console.log(`job[${index}] do some stuff`);
        await queue.sleep(0.5); // sleep for 0.5 seconds
        console.log(`job[${index}] do some stuff again`);
        await queue.sleep(0.5); // sleep for 0.5 seconds
        console.log(`job[${index}] with sleep done`);
    } else {
        console.log(`job[${index}] without sleep`);
    }

    // release our queue and let next job do some stuff
    queue.release();
}

for(let i = 0; i < 10; i++) {
    doSome(i, i <= 1);
}

Output:

job[0] with sleep started
job[0] do some stuff
job[0] do some stuff again
job[0] with sleep done
job[1] with sleep started
job[1] do some stuff
job[1] do some stuff again
job[1] with sleep done
job[2] without sleep
job[3] without sleep
job[4] without sleep
job[5] without sleep
job[6] without sleep
job[7] without sleep
job[8] without sleep
job[9] without sleep

Exmaple #2

const QueueHolder = require('queue-holder');
const queue = new QueueHolder();

(async () => {
    await queue.hold();
    console.log(1);
    await queue.sleep(1);
    queue.release();
    await queue.hold();
    console.log(2);
    await queue.sleep(1);
    queue.release();
})();

(async () => {
    await queue.hold();
    console.log(3);
    await queue.sleep(1);
    queue.release();
    await queue.hold();
    console.log(4);
    await queue.sleep(1);
    queue.release();
})();

Output:

1
3
2
4

API

  • .hold() - hold queue. This function returns Promise.
  • .release() - release our queue and let next job do some stuff. Returns false if nothing to release, else returns true.
  • .sleep(seconds = 1) - sleep for seconds seconds. This function returns Promise.
  • .inQueue() - how much tasks in queue.