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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@vates/generator-toolbox

v1.1.0

Published

<!-- DO NOT EDIT MANUALLY, THIS FILE HAS BEEN GENERATED -->

Readme

@vates/generator-toolbox

Package Version License PackagePhobia Node compatibility

Install

Installation of the npm package:

npm install --save @vates/generator-toolbox

Usage

A toolbox to ease the use of generator

Timeout

wrap a source async generator to have it throw an error when timeout is reached timeout is a positive number in milliseconds

import { Timeout } from '@vates/generator-toolbox'

const wrappedGenerator = new Timeout(sourceGenerator, timeout)

Throttle

wrap a source async generator to have it respect a max speed ( in bytes per seconds). speed is either a strictly positive number or a function returning a strictly positive number. A speed change will be used for the next emitted packet.

The source generator must yield object with a length property.

Optimized for small yields regarding to the speed, since it won't split incoming packet.

If the generator reached the max speed it will be paused, limiting memory consumption.

import { Throttle } from '@vates/generator-toolbox'

const wrappedGenerator = new Throttle(sourceGenerator, speed)

Synchronized

Fork a generator. The rules are:

  • if the source returns, all the forks return
  • if the forks error, all the forks error with the same error
  • if a fork returns, it is stopped, but the generator continue with the other
  • if a fork errors, it is stopped, but the generator continue with the other
  • if all the forks return, the source is stopped
  • if all the forks error, the source is errored with the last error
  • the source start producing a packet when the fastest forked ask for it
  • the source forks get the packet only when all the forks asked for it, no buffer stores in memory
import { Synchronized } from '@vates/generator-toolbox'

async function consume(generator: AsyncGenerator) {
  for await (const val of generator) {
    console.log({ val })
  }
}
const forker = new Synchronized(generator)
const first = forker.fork('first')
const second = forker.fork('second')
await Promise.all([consume(first), consume(second)])

Note: you can stop early a generator by calling generator.return(), and you can stop in in error by calling generator.throw(error)

Contributions

Contributions are very welcomed, either on the documentation or on the code.

You may:

  • report any issue you've encountered;
  • fork and create a pull request.

License

MIT © Vates SAS