source: node_modules/ramda-adjunct/lib/allSettledP.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
RevLine 
[d24f17c]1"use strict";
2
3exports.__esModule = true;
4exports["default"] = exports.allSettledPPonyfill = void 0;
5var _ramda = require("ramda");
6var _isFunction = _interopRequireDefault(require("./isFunction"));
7var _Promise = _interopRequireDefault(require("./internal/ponyfills/Promise.allSettled"));
8function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
9var allSettledPPonyfill = (0, _ramda.curryN)(1, _Promise["default"]);
10
11/**
12 * Returns a promise that is fulfilled with an array of promise state snapshots,
13 * but only after all the original promises have settled, i.e. become either fulfilled or rejected.
14 * We say that a promise is settled if it is not pending, i.e. if it is either fulfilled or rejected.
15 *
16 * @func allSettledP
17 * @memberOf RA
18 * @since {@link https://char0n.github.io/ramda-adjunct/2.18.0|v2.18.0}
19 * @category Function
20 * @typedef Settlement = { status: String, value: * }
21 * @sig [Promise a] -> Promise [Settlement a]
22 * @param {Iterable.<*>} iterable An iterable object such as an Array or String
23 * @return {Promise} Returns a promise that is fulfilled with an array of promise state snapshots
24 * @see {@link RA.allP|allP}
25 * @example
26 *
27 * RA.allSettledP([
28 * Promise.resolve(1),
29 * 2,
30 * Promise.reject(3),
31 * ]); //=> Promise([{ status: 'fulfilled', value: 1 }, { status: 'fulfilled', value: 2 }, { status: 'rejected', reason: 3 }])
32 */
33exports.allSettledPPonyfill = allSettledPPonyfill;
34var allSettledP = (0, _isFunction["default"])(Promise.allSettled) ? (0, _ramda.curryN)(1, (0, _ramda.bind)(Promise.allSettled, Promise)) : allSettledPPonyfill;
35var _default = allSettledP;
36exports["default"] = _default;
Note: See TracBrowser for help on using the repository browser.