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 🙏

© 2024 – Pkg Stats / Ryan Hefner

stepp

v0.0.3

Published

Set a maximum concurrency for your Promises.

Downloads

6

Readme

stepp Build Status codecov Greenkeeper badge

Promise-compatiable Promise wrapper for controlling concurrency of promises.

Quick Start

The idea is for step to be a drop-in replacement for your promises (in terms of syntax), but for the execution to be delayed. So you can create a step with a given job but it will not execute until you run step.run(). This can be used to "delay" execution (similar to wrapping a promise with a function) or more importantly, used to limit concurrency.

To limit concurrency while executing many steps, you can do something like this:

const Step = require('stepp')
const values = [... new Array(1000).keys()]

const steps = values.map(id => {
  return new Step((resolve, reject) => {
    resolve(id)
  })
})

// steps will be a list of steps where each step should resolve
// a different id from the list of values
// 
// `.all()` returns a promise, so you can use it as you would use
// `Promise.all()`.
Step.all(steps)
  .then(newValues => {
    // newValues is deep equal to values
    // not necessarily in the right order though - race conditions
    // and what not
  })

API

.all(steps, [options])

  • steps (array of Steps): the steps to execute.
  • options (object): configuration object with the following properties:
    • failFast (boolean; default: true):
      • if true, the all promise is rejected as soon as an error occurs.
      • if false, the all promise is rejected after running all the steps with an array of errors.
    • maxConcurrency (number): the maximum number of steps that can be run in parallel.

License

Licensed under MIT license.

Copyright © 2017-present Foko Inc. All rights reserved.