source: node_modules/ramda-adjunct/lib/allP.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.6 KB
Line 
1"use strict";
2
3exports.__esModule = true;
4exports["default"] = void 0;
5var _ramda = require("ramda");
6/**
7 * Composable shortcut for `Promise.all`.
8 *
9 * The `allP` method returns a single Promise that resolves when all of the promises
10 * in the iterable argument have resolved or when the iterable argument contains no promises.
11 * It rejects with the reason of the first promise that rejects.
12 *
13 * @func allP
14 * @memberOf RA
15 * @since {@link https://char0n.github.io/ramda-adjunct/2.3.0|v2.3.0}
16 * @category Function
17 * @sig [Promise a] -> Promise [a]
18 * @param {Iterable.<*>} iterable An iterable object such as an Array or String
19 * @return {Promise} An already resolved Promise if the iterable passed is empty. An asynchronously resolved Promise if the iterable passed contains no promises. Note, Google Chrome 58 returns an already resolved promise in this case. A pending Promise in all other cases. This returned promise is then resolved/rejected asynchronously (as soon as the stack is empty) when all the promises in the given iterable have resolved, or if any of the promises reject. See the example about "Asynchronicity or synchronicity of allP" below.
20 * @see {@link RA.resolveP|resolveP}, {@link RA.rejectP|rejectP}
21 * @example
22 *
23 * RA.allP([1, 2]); //=> Promise([1, 2])
24 * RA.allP([1, Promise.resolve(2)]); //=> Promise([1, 2])
25 * RA.allP([Promise.resolve(1), Promise.resolve(2)]); //=> Promise([1, 2])
26 * RA.allP([1, Promise.reject(2)]); //=> Promise(2)
27 */
28var allP = (0, _ramda.curryN)(1, (0, _ramda.bind)(Promise.all, Promise));
29var _default = allP;
30exports["default"] = _default;
Note: See TracBrowser for help on using the repository browser.