1 | "use strict";
|
---|
2 |
|
---|
3 | function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
---|
4 | exports.__esModule = true;
|
---|
5 | exports["default"] = exports.anyPPonyfill = void 0;
|
---|
6 | var _ramda = require("ramda");
|
---|
7 | var _isFunction = _interopRequireDefault(require("./isFunction"));
|
---|
8 | var _Promise = _interopRequireWildcard(require("./internal/ponyfills/Promise.any"));
|
---|
9 | exports.AggregatedError = _Promise.AggregatedError;
|
---|
10 | function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
---|
11 | function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
---|
12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
---|
13 | var anyPPonyfill = (0, _ramda.curryN)(1, _Promise["default"]);
|
---|
14 | exports.anyPPonyfill = anyPPonyfill;
|
---|
15 | /**
|
---|
16 | * Returns a promise that is fulfilled by the first given promise to be fulfilled,
|
---|
17 | * or rejected with an array of rejection reasons if all of the given promises are rejected.
|
---|
18 | *
|
---|
19 | * @func anyP
|
---|
20 | * @memberOf RA
|
---|
21 | * @category Function
|
---|
22 | * @since {@link https://char0n.github.io/ramda-adjunct/2.22.0|v2.22.0}
|
---|
23 | * @sig [Promise a] -> Promise a
|
---|
24 | * @param {Iterable.<*>} iterable An iterable object such as an Array or String
|
---|
25 | * @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
|
---|
26 | * @see {@link RA.lastP|lastP}
|
---|
27 | * @example
|
---|
28 | *
|
---|
29 | * RA.anyP([
|
---|
30 | * Promise.resolve(1),
|
---|
31 | * 2,
|
---|
32 | * Promise.reject(3),
|
---|
33 | * ]); //=> Promise(1)
|
---|
34 | */
|
---|
35 | var anyP = (0, _isFunction["default"])(Promise.any) ? (0, _ramda.curryN)(1, (0, _ramda.bind)(Promise.any, Promise)) : anyPPonyfill;
|
---|
36 | var _default = anyP;
|
---|
37 | exports["default"] = _default; |
---|