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.
18 lines (12 loc) • 430 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;