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

@moznion/miniq

v0.0.1

Published

A minimal in-process queue system for TypeScript/JavaScript.

Readme

miniq .github/workflows/check.yml codecov

A minimal in-process queue system for TypeScript/JavaScript that supports TTL mechanism.

Synopsis

let i = 0;
const queueTaskRunner = new QueueTaskRunner<number>();

const task1 = await Task.make<number>(async (): Promise<number> => {
  return new Promise<number>(resolve => {
    setTimeout(() => {
      resolve(++i);
    }, 500);
  });
});
const task2 = await Task.make<number>(async (): Promise<number> => {
  return new Promise<number>(resolve => {
    resolve(++i);
  });
});
const task3 = await Task.make<number>(async (): Promise<number> => {
  return new Promise<number>(resolve => {
    resolve(++i);
  });
});

queueTaskRunner.enqueue(task1); // runner runs task1, and the task takes 500ms
queueTaskRunner.enqueue(task2); // runner queues task2 and defer it after task1
queueTaskRunner.enqueue(task3); // runner queues task3 and defer it after task2

console.log(await task1.getResult()); // => 1
console.log(await task2.getResult()); // => 2
console.log(await task3.getResult()); // => 3

Description

QueueTaskRunner#enqueue(task: Task<T>) receives a task and appends that task to the queue and runs the tasks in a queue from the beginning of the queue.

Task<T> represents the task that you wanted to do according to the FIFO, and the task runner executes the enqueued task's async do(): Promise<void>. The point is this do() returns the Promise<void> so the client code cannot get the result of the actual procedure, but you can use async Task#getResult(): Promise<T> to take that. So the basic usage should be enqueuing a task and waiting for the result by await getResult() for the task.

Please see also typedoc.

TTL

You can give a task the TTL like:

const task = await Task.make<string>(async (): Promise<string> => {
  return 'foo';
}, Date.now() + 60000);
// ~~~~~~~~~~~~~~~~~~ TTL that represents 60 secs from now

...

await task.getResult(); // if the TTL has exceeded, it rejects this task and throws `TaskTTLExceededError`.

And a task that has the TTL has been enqueued and when the task runner takes the task to run, if the TTL exceeds the current timestamp at that moment, it doesn't run that task and it rejects the task with TaskTTLExceededError.

LISENCE

MIT