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

clever-queue

v0.2.4

Published

Queuing system for promises that handle concurring, throttling, weighting and prioritizing in a clever fashion.

Readme

clever-queue

Purpose

Queuing system for promises that handle concurring, throttling, weighting and prioritizing in a clever fashion ?

Zero dependancies.

Features

  • [X] Promises
  • [X] Concurrency running
  • [X] Priority & BestEffort queues
  • [X] Weighted Queue
  • [ ] Throttling

Architecture - clever-queue implements 4 classes :

  • engine : this is the starting point of clever-queue. You must instantiate at least one engine in your program. You may instantiate multiple engines if needed.
  • task : this is what we would like to execute. It may be an async or a sync function
  • runner : It is in charge of the execution of tasks. It runs tasks, one by one. You must have at least one runner in an engine (one best-effort runner is automatically created on engine instantiation). If you need concurrency running, you may instantiate as many runners as needed. You may configure each runner in a way that it will only execute tasks coming from queues that have an equal or higher priority than runner priority.
  • queue : It is in charge of keeping tasks in a deterministic order (FIFO : First In, First Out by default), waiting for an available runner. You must have at least one queue in an engine. You may instantiate as many queues you need and manage priorities and weights between queues.
import * as cleverQueue from "clever-queue"; // import the library - no dependancies

const engine = cleverQueue.createEngine(); // create and start (by default) engine with a single best effort runner (by default)
const queue = engine.createQueue(); // create your first queue, with standard priority (by default) and default weight (by default) 

const myAsyncTaskToExecute: cleverQueue.tasks.FunctionToExecute = async function (message: string, timeout: number) {
    // do your stuff here - In this case, just wait for the timeout and return the message
    await new Promise((resolve) => setTimeout(resolve, timeout));
    return message;
};

(async () => {
    const result = await queue.createTaskAndEnqueue(() => myAsyncTaskToExecute("myValue", 1000));
    console.log(result);
    engine.stop(); // stop the engine when you have finished
})();

Examples

1 x Queue / 1 x Runner / 4 x Tasks

  const engine = cleverQueue.createEngine();
  const queueA = engine.createQueue();

One Queue / One Runner

1 x Queue / 2 x Runners / 4 x Tasks

  const engine = cleverQueue.createEngine();
  engine.createRunner({ priority: cleverQueue.queues.Priorities.BestEffort });
  const queueA = engine.createQueue();

One Queue / One Runner

2 x Queues / 1 x Runner / 8 x Tasks

  const engine = cleverQueue.createEngine();
  const queueA = engine.createQueue();
  const queueB = engine.createQueue();

One Queue / One Runner