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:
697 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | import { bind } from 'ramda';
|
---|
| 2 |
|
---|
| 3 | /**
|
---|
| 4 | * Composable shortcut for `Promise.reject`.
|
---|
| 5 | *
|
---|
| 6 | * Returns a Promise object that is rejected with the given reason.
|
---|
| 7 | *
|
---|
| 8 | * @func rejectP
|
---|
| 9 | * @memberOf RA
|
---|
| 10 | * @since {@link https://char0n.github.io/ramda-adjunct/1.16.0|v1.16.0}
|
---|
| 11 | * @category Function
|
---|
| 12 | * @sig a -> Promise a
|
---|
| 13 | * @param {*} [reason=undefined] Reason why this Promise rejected
|
---|
| 14 | * @return {Promise} A Promise that is rejected with the given reason
|
---|
| 15 | * @see {@link RA.resolveP|resolveP}
|
---|
| 16 | * @example
|
---|
| 17 | *
|
---|
| 18 | * RA.rejectP(); //=> Promise(undefined)
|
---|
| 19 | * RA.rejectP('a'); //=> Promise('a')
|
---|
| 20 | * RA.rejectP([1, 2, 3]); //=> Promise([1, 2, 3])
|
---|
| 21 | */
|
---|
| 22 | const rejectP = bind(Promise.reject, Promise);
|
---|
| 23 |
|
---|
| 24 | export default rejectP;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.