mirror of
https://github.com/log4js-node/log4js-node.git
synced 2025-12-08 19:26:01 +00:00
test: polyfill Promise.allSettled for Node.js <12
This commit is contained in:
parent
39218cc8d0
commit
bf57536760
@ -13,3 +13,21 @@ sandbox.configure({
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// polyfill for Node.js <12
|
||||
Promise.allSettled =
|
||||
Promise.allSettled ||
|
||||
((promises) =>
|
||||
Promise.all(
|
||||
promises.map((p) =>
|
||||
p
|
||||
.then((value) => ({
|
||||
status: 'fulfilled',
|
||||
value,
|
||||
}))
|
||||
.catch((reason) => ({
|
||||
status: 'rejected',
|
||||
reason,
|
||||
}))
|
||||
)
|
||||
));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user