source: node_modules/ramda-adjunct/src/internal/ponyfills/Promise.allSettled.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 433 bytes
Line 
1import { map } from 'ramda';
2
3import allP from '../../allP';
4import resolveP from '../../resolveP';
5
6const onFulfill = (value) => ({ status: 'fulfilled', value });
7const onReject = (reason) => ({ status: 'rejected', reason });
8
9const allSettledPonyfill = (iterable) => {
10 const array = map(
11 (p) => resolveP(p).then(onFulfill).catch(onReject),
12 [...iterable]
13 );
14
15 return allP(array);
16};
17
18export default allSettledPonyfill;
Note: See TracBrowser for help on using the repository browser.