1.0.5 • Published 6 years ago

promise-limiter v1.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

Promise Limiter

Like Promise.all, but limits the number of functions running simultaneously.

Example

const PromiseLimit = require('promise-limiter');

const results = await PromiseLimit([1, 2, 3, 4, 5], 2, async (val) => {
  // Do some async stuff
  return val * val;
});

console.log(results);
// [1, 4, 9, 16, 25]

The second parameter can also be an options obj:

PromiseLimit(arr, {
  ignoreErrors: true,
  limit: 3,
}, async () => {});
1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago