promise-each-concurrency

3.0.0 • Public • Published

Promise each concurrency Build Status

Process an iterable of promises with concurrency

Table of Contents

Install

npm i promise-each-concurrency
 
# Or with Yarn 
yarn add promise-each-concurrency

Usage

import promiseEach from `promise-each-concurrency`;
 
promiseEach(
  [1, 2, 3],
  function(x) {
    return new Promise(function(resolve) {
      setTimeout(resolve.bind(undefined, x), 1000);
    })
  },
  {
    concurrency: 1
  }
);

Will produce:

1
2
3

With a 1 second pause between each line.

API

promiseEach(
  Iterable<any> input,
  function(any item) iterator,
  options
) -> Promise

Options

Name Default Description
concurrency Math.infinity how many items to process at once, default is no limit

Contributing

See the contribute file!

PRs accepted.

License

MIT © Michael Leaney

Readme

Keywords

none

Package Sidebar

Install

npm i promise-each-concurrency

Weekly Downloads

228

Version

3.0.0

License

none

Unpacked Size

176 kB

Total Files

15

Last publish

Collaborators

  • leahcimic