ramda-adjunct
Version:
Ramda Adjunct is the most popular and most comprehensive set of utilities for use with Ramda, providing a variety of useful, well tested functions with excellent documentation.
22 lines (16 loc) • 449 B
JavaScript
import { map } from 'ramda';
import allP from '../../allP';
import resolveP from '../../resolveP';
const onFulfill = value => ({ status: 'fulfilled', value });
const onReject = reason => ({ status: 'rejected', reason });
const allSettledPolyfill = iterable => {
const array = map(
p =>
resolveP(p)
.then(onFulfill)
.catch(onReject),
[...iterable]
);
return allP(array);
};
export default allSettledPolyfill;