mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-23 10:18:40 +00:00
And rewrite all the require calls. ```bash git mv src/utils/* packages/@uppy/utils/src sed -i 's/[./]*\/utils\//@uppy\/utils\/lib\//' src/**/*.js # transform (../)*utils → @uppy/utils ```
21 lines
425 B
JavaScript
21 lines
425 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
|
|
}
|
|
})
|
|
}
|