promise-one

1.0.0 • Public • Published

promise-one

Build Status npm install npm version js-standard-style License

Promise that at least one promise will resolve

Example

const promiseOne = require('promise-one')
 
promiseOne([promise1, promise2, promise3])
  .then(function (data) {
    // one of them worked!
    console.log(data)
  })
  .catch(function (err) {
    // they all rejected :(
  })

API

promiseOne([promise1, ...]) -> Promise

  • Accepts an array of promises
  • Resolves as soon as one of the promises resolves
  • Rejects only if all of the promises reject

Notes

  • Rejections will disappear if any promise resolves, with no way to get them.
  • If all promises reject, their errors will be available on the rejected reason under the errors key in the order they were specified in the original array.

License

MIT

/promise-one/

    Package Sidebar

    Install

    npm i promise-one

    Weekly Downloads

    1

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • jarofghosts