You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
595 B

4 years ago
  1. import _curry2 from "./internal/_curry2.js";
  2. /**
  3. * Takes a value and applies a function to it.
  4. *
  5. * This function is also known as the `thrush` combinator.
  6. *
  7. * @func
  8. * @memberOf R
  9. * @since v0.25.0
  10. * @category Function
  11. * @sig a -> (a -> b) -> b
  12. * @param {*} x The value
  13. * @param {Function} f The function to apply
  14. * @return {*} The result of applying `f` to `x`
  15. * @example
  16. *
  17. * const t42 = R.applyTo(42);
  18. * t42(R.identity); //=> 42
  19. * t42(R.add(1)); //=> 43
  20. */
  21. var applyTo =
  22. /*#__PURE__*/
  23. _curry2(function applyTo(x, f) {
  24. return f(x);
  25. });
  26. export default applyTo;