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

tamesy

v1.1.2

Published

Tames a set of wild concurrent promises

Downloads

27

Readme

tamesy

npm version Build Status ♦️ Dependency Status ♦️ devDependency Status ♦️

Tames a set of wild concurrent promises.

Installation

npm i tamesy -save

Documentation

Tamesy exposes a map function to map over a set of Promises or a iterator factory with a given concurrency.

API

Tamesy exposes a map function as its default export. The map function takes the following arguments:

  • [Function<Promise>] Array containing functions which return Promises serving as the factory (lazy).
  • Number=Infinity Maximum limit of concurrently running Promises.
  • Function Optional if passed a function invoked with each item which should return a Promise.
  • Function Optional log function if passed a function to be used for debugging (e.g. debug in examples).
  • Function Optional if passed a function providing a Promise (to overwrite native Promises e.g. O.Promise.

Tamesy returns a Promise which resolves to an Array whenever all tasks have ben run. The order of items is maintained - same as in the list of factory functions passed.

Module formats

Tamesy is built as a UMD module using webpack. The distribution version is not added to git but created as a preversion script.

  • ...ESM just import the src/index.js within your app.
  • ...CommonJS use the dist/tamesy.js
  • ...AMD use the dist/tamesy.js
  • ...<script /> link it to dist/tamesy.js or dist/tamesy.min.js

All build files are part of the npm distribution using the files array to keep install time short.

Also feel free to use unpkg.com as a CDN to the dist files.

Examples

import map from 'tamesy';
/**
 * Delay execution by time ms
 * @method delay
 * @param  {integer} time [delay in milliseconds]
 * @return {Promise}      [promise to chain into]
 */
function delay(timeout) {
    return new Promise(resolve => {
        setTimeout(resolve, timeout);
    })
}
/**
 * Queue of n items with max given
 * @method queue
 * @param  {integer} length [length of queue]
 * @param  {integer} max    [maximum integer within queue]
 * @return {Array}          [queue with items]
 */
function queue(length, max) {
    return [...new Array(length)].map(() => Math.round(Math.random() * max))
}

// Queue map'ed onto delay factories (lazy Promises)
const syncQueue = queue(10, 50)
const asyncQueue = syncQueue.map(ms => () => delay(ms))

console.huraaay = (msg, props) => console.info(`🎉 ${msg} 🍻`, props)

console.info('🏁 Starting the race 1...')
// Given a queue with 10 items and a maximum delay of 50ms
// execute two tasks concurrently without a factory function.
map(asyncQueue, 2, false, null, log).then(props => console.huraaay('All work WITHOUT iterator done! ', props))

console.info('🏁 Starting the race 2...')
// Given the same queue pipe each item of the iterable into the factory function.
map(syncQueue, 2, delay, null, log).then(props => console.huraaay('All work WITH iterator done! ', props))