Ramda Adjunct 2.7.0

rejectP.js

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