Ramda Adjunct 2.30.0

thenP.js

  1. import { invoker } from 'ramda';
  2. /**
  3. * Composable shortcut for `Promise.then`.
  4. * The thenP function returns a Promise. It takes two arguments: a callback function for the success of the Promise
  5. * and the promise instance itself.
  6. *
  7. * @func thenP
  8. * @memberOf RA
  9. * @aliases then
  10. * @since {@link https://char0n.github.io/ramda-adjunct/2.8.0|v2.8.0}
  11. * @deprecated since v2.12.0; available in ramda@0.26.0 as R.then
  12. * @category Function
  13. * @sig (a -> Promise b | b) -> Promise b
  14. * @param {Function} onFulfilled A Function called if the Promise is fulfilled. This function has one argument, the fulfillment value
  15. * @param {Promise} promise Any Promise or Thenable object
  16. * @return {Promise} A Promise in the pending status
  17. * @see {@link RA.resolveP|resolveP}, {@link RA.rejectP|rejectP}, {@link RA.allP|allP}
  18. * @example
  19. *
  20. * const promise = Promise.resolve(1);
  21. * const add1 = v => v + 1;
  22. *
  23. * RA.thenP(add1, promise); // => Promise(2)
  24. */
  25. const thenP = invoker(1, 'then');
  26. export default thenP;