1.0.0 • Published 8 years ago
promise-one v1.0.0
promise-one
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
1.0.0
8 years ago