source: node_modules/ramda-adjunct/lib/thenCatchP.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.3 KB
Line 
1"use strict";
2
3exports.__esModule = true;
4exports.thenCatchP = exports["default"] = void 0;
5var _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 */
28var thenCatchP = (0, _ramda.invoker)(2, 'then');
29exports.thenCatchP = thenCatchP;
30var _default = thenCatchP;
31exports["default"] = _default;
Note: See TracBrowser for help on using the repository browser.