[d24f17c] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | exports.__esModule = true;
|
---|
| 4 | exports.thenCatchP = exports["default"] = void 0;
|
---|
| 5 | var _ramda = require("ramda");
|
---|
| 6 | /**
|
---|
| 7 | * Composable shortcut for `Promise.then` that allows for success and failure callbacks.
|
---|
| 8 | * The thenCatchP function returns a Promise. It takes three arguments: a callback function for the success of the Promise,
|
---|
| 9 | * a callback function for the failure of the Promise, and the promise instance itself.
|
---|
| 10 | *
|
---|
| 11 | * @func thenCatchP
|
---|
| 12 | * @memberOf RA
|
---|
| 13 | * @since {@link https://char0n.github.io/ramda-adjunct/2.27.0|v2.27.0}
|
---|
| 14 | * @category Function
|
---|
| 15 | * @sig (a -> b) -> (c -> d) -> Promise a -> Promise b | d
|
---|
| 16 | * @param {Function} onFulfilled A Function called if the Promise is fulfilled. This function has one argument, the fulfillment value
|
---|
| 17 | * @param {Function} onRejected A Function called if the Promise is rejected. This function has one argument, the error
|
---|
| 18 | * @param {Promise} promise Any Promise or Thenable object
|
---|
| 19 | * @return {Promise}
|
---|
| 20 | * @see {@link RA.resolveP|resolveP}, {@link RA.rejectP|rejectP}, {@link RA.allP|allP}
|
---|
| 21 | * @example
|
---|
| 22 | *
|
---|
| 23 | * const promise = Promise.resolve(1);
|
---|
| 24 | * const add1 = x => x + 1;
|
---|
| 25 | *
|
---|
| 26 | * RA.thenCatchP(add1, console.error, promise); // => Promise(2)
|
---|
| 27 | */
|
---|
| 28 | var thenCatchP = (0, _ramda.invoker)(2, 'then');
|
---|
| 29 | exports.thenCatchP = thenCatchP;
|
---|
| 30 | var _default = thenCatchP;
|
---|
| 31 | exports["default"] = _default; |
---|