1 var createWrapper = require('../internal/createWrapper'),
2 isIterateeCall = require('../internal/isIterateeCall');
4 /** Used to compose bitmasks for wrapper metadata. */
7 /* Native method references for those with the same name as other `lodash` methods. */
8 var nativeMax = Math.max;
11 * Creates a function that accepts up to `n` arguments ignoring any
12 * additional arguments.
17 * @param {Function} func The function to cap arguments for.
18 * @param {number} [n=func.length] The arity cap.
19 * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.
20 * @returns {Function} Returns the new function.
23 * _.map(['6', '8', '10'], _.ary(parseInt, 1));
26 function ary(func, n, guard) {
27 if (guard && isIterateeCall(func, n, guard)) {
30 n = (func && n == null) ? func.length : nativeMax(+n || 0, 0);
31 return createWrapper(func, ARY_FLAG, undefined, undefined, undefined, undefined, n);