Ramda Adjunct 2.33.0

dropArgs.js

  1. import { nAry } from 'ramda';
  2. /**
  3. * Accepts a function with any arity and returns a function with arity of zero.
  4. * The returned function ignores any arguments supplied to it.
  5. *
  6. * @func dropArgs
  7. * @memberOf RA
  8. * @since {@link https://char0n.github.io/ramda-adjunct/2.10.0|v2.10.0}
  9. * @category Logic
  10. * @sig (...a -> b)-> () -> b
  11. * @param {Function} fn The function with any arity
  12. * @return {Function} Returns function with arity of zero
  13. * @see {@link http://ramdajs.com/docs/#nAry|R.nAry}
  14. * @example
  15. *
  16. * const fn = (a = 1, b = 2) => a + b;
  17. *
  18. * RA.dropArgs(fn)('ignore1', 'ignore2'); //=> 3
  19. */
  20. const dropArgs = nAry(0);
  21. export default dropArgs;