ramda-adjunct
Version:
Ramda Adjunct is the most popular and most comprehensive set of utilities for use with Ramda, providing a variety of useful, well tested functions with excellent documentation.
27 lines (26 loc) • 1.06 kB
JavaScript
exports.__esModule = true;
exports["default"] = void 0;
var _ramda = require("ramda");
/**
* Composable shortcut for `Promise.catch`.
* The catchP function returns a Promise. It takes two arguments: a callback function for the failure of the Promise
* and the promise instance itself.
*
* @func catchP
* @memberOf RA
* @since {@link https://char0n.github.io/ramda-adjunct/2.29.0|v2.29.0}
* @category Function
* @sig (a -> Promise b | b) -> Promise b
* @param {Function} onRejected A Function called if the Promise is rejected. This function has one argument, the rejection reason.
* @param {Promise} promise Any Promise
* @return {Promise} Returns a Promise with dealt rejected cases
* @see {@link RA.thenP|thenP}, {@link RA.resolveP|resolveP}, {@link RA.rejectP|rejectP}, {@link RA.allP|allP}
*
* @example
*
* RA.catchP(() => 'b', Promise.resolve('a')); //=> Promise('a')
* RA.catchP(() => 'b', Promise.reject('a')); //=> Promise('b')
*/
var catchP = (0, _ramda.invoker)(1, 'catch');
var _default = exports["default"] = catchP;
;