1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.allSettled = void 0;
|
4 |
|
5 | function allSettled(values) {
|
6 | return Promise.all(values.map(item => {
|
7 | const onFulfill = (value) => {
|
8 | return { status: 'fulfilled', value };
|
9 | };
|
10 | const onReject = (reason) => {
|
11 | return { status: 'rejected', reason };
|
12 | };
|
13 | const itemPromise = Promise.resolve(item);
|
14 | try {
|
15 | return itemPromise.then(onFulfill, onReject);
|
16 | }
|
17 | catch (error) {
|
18 | return Promise.reject(error);
|
19 | }
|
20 | }));
|
21 | }
|
22 | exports.allSettled = allSettled;
|