JSPM

promise-serial-exec

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 106
  • Score
    100M100P100Q61225F
  • License MIT

Execute promises sequentially, aka sequential `Promise.all`.

Package Exports

  • promise-serial-exec

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (promise-serial-exec) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

promise-serial-exec

npm license github-issues Circle CI build status

nodei.co

Execute promises sequentially, aka sequential Promise.all.

Can be useful for CPU-intensive operations, databases, scrapping...

Usage

const serialExec = require('promise-serial-exec')

const urls = [
  url1,
  url2,
  url3
];

// make the promise callables so they're executed on-demand
const promiseCalls = urls.map((url, i) => () => fetch(url))

// urls will be fetched in order
serialExec(promiseCalls).then(console.log)


// will add a 0-500ms delay between each call
serialExec(promiseCalls, {
  randomTimeout: 500
}).then(console.log)