source: node_modules/ramda-adjunct/es/anyP.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: 1.1 KB
Line 
1import { bind, curryN } from 'ramda';
2import isFunction from './isFunction';
3import ponyfill, { AggregatedError } from './internal/ponyfills/Promise.any';
4export var anyPPonyfill = curryN(1, ponyfill);
5export { AggregatedError };
6
7/**
8 * Returns a promise that is fulfilled by the first given promise to be fulfilled,
9 * or rejected with an array of rejection reasons if all of the given promises are rejected.
10 *
11 * @func anyP
12 * @memberOf RA
13 * @category Function
14 * @since {@link https://char0n.github.io/ramda-adjunct/2.22.0|v2.22.0}
15 * @sig [Promise a] -> Promise a
16 * @param {Iterable.<*>} iterable An iterable object such as an Array or String
17 * @return {Promise} A promise that is fulfilled by the first given promise to be fulfilled, or rejected with an array of rejection reasons if all of the given promises are rejected
18 * @see {@link RA.lastP|lastP}
19 * @example
20 *
21 * RA.anyP([
22 * Promise.resolve(1),
23 * 2,
24 * Promise.reject(3),
25 * ]); //=> Promise(1)
26 */
27var anyP = isFunction(Promise.any) ? curryN(1, bind(Promise.any, Promise)) : anyPPonyfill;
28export default anyP;
Note: See TracBrowser for help on using the repository browser.