main
Last change
on this file since 65b6638 was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Rev | Line | |
---|
[d24f17c] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | exports.__esModule = true;
|
---|
| 4 | exports["default"] = void 0;
|
---|
| 5 | var _ramda = require("ramda");
|
---|
| 6 | /**
|
---|
| 7 | * Composable shortcut for `Promise.catch`.
|
---|
| 8 | * The catchP function returns a Promise. It takes two arguments: a callback function for the failure of the Promise
|
---|
| 9 | * and the promise instance itself.
|
---|
| 10 | *
|
---|
| 11 | * @func catchP
|
---|
| 12 | * @memberOf RA
|
---|
| 13 | * @since {@link https://char0n.github.io/ramda-adjunct/2.29.0|v2.29.0}
|
---|
| 14 | * @category Function
|
---|
| 15 | * @sig (a -> Promise b | b) -> Promise b
|
---|
| 16 | * @param {Function} onRejected A Function called if the Promise is rejected. This function has one argument, the rejection reason.
|
---|
| 17 | * @param {Promise} promise Any Promise
|
---|
| 18 | * @return {Promise} Returns a Promise with dealt rejected cases
|
---|
| 19 | * @see {@link RA.thenP|thenP}, {@link RA.resolveP|resolveP}, {@link RA.rejectP|rejectP}, {@link RA.allP|allP}
|
---|
| 20 | *
|
---|
| 21 | * @example
|
---|
| 22 | *
|
---|
| 23 | * RA.catchP(() => 'b', Promise.resolve('a')); //=> Promise('a')
|
---|
| 24 | * RA.catchP(() => 'b', Promise.reject('a')); //=> Promise('b')
|
---|
| 25 | */
|
---|
| 26 | var catchP = (0, _ramda.invoker)(1, 'catch');
|
---|
| 27 | var _default = catchP;
|
---|
| 28 | exports["default"] = _default; |
---|
Note:
See
TracBrowser
for help on using the repository browser.