Ohm-Management - Projektarbeit B-ME
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.

ary.js 857B

1234567891011121314151617181920212223242526272829
  1. var createWrap = require('./_createWrap');
  2. /** Used to compose bitmasks for function metadata. */
  3. var WRAP_ARY_FLAG = 128;
  4. /**
  5. * Creates a function that invokes `func`, with up to `n` arguments,
  6. * ignoring any additional arguments.
  7. *
  8. * @static
  9. * @memberOf _
  10. * @since 3.0.0
  11. * @category Function
  12. * @param {Function} func The function to cap arguments for.
  13. * @param {number} [n=func.length] The arity cap.
  14. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  15. * @returns {Function} Returns the new capped function.
  16. * @example
  17. *
  18. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  19. * // => [6, 8, 10]
  20. */
  21. function ary(func, n, guard) {
  22. n = guard ? undefined : n;
  23. n = (func && n == null) ? func.length : n;
  24. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  25. }
  26. module.exports = ary;