uppy/packages/@uppy/utils/src/settle.js
Kevin van Zonneveld bfe659820e
Upgrade linting to 2.0.0-0 (#3280)
* Upgrade linting to 2.0.0-0

* Adjust so we can pass without error

* Fix linting

* Update header-blacklist.js

* Update index.js

* Update Uppy.js

* Update Components.js

* Update StatusBar.js

* Update Assembly.js

* Upgrade to linting 2.0.0 (final release)
2021-11-09 11:19:05 +00:00

21 lines
427 B
JavaScript

module.exports = function settle (promises) {
const resolutions = []
const rejections = []
function resolved (value) {
resolutions.push(value)
}
function rejected (error) {
rejections.push(error)
}
const wait = Promise.all(
promises.map((promise) => promise.then(resolved, rejected)),
)
return wait.then(() => {
return {
successful: resolutions,
failed: rejections,
}
})
}