source: imaps-frontend/node_modules/lodash-es/ary.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 855 bytes
Line 
1import createWrap from './_createWrap.js';
2
3/** Used to compose bitmasks for function metadata. */
4var WRAP_ARY_FLAG = 128;
5
6/**
7 * Creates a function that invokes `func`, with up to `n` arguments,
8 * ignoring any additional arguments.
9 *
10 * @static
11 * @memberOf _
12 * @since 3.0.0
13 * @category Function
14 * @param {Function} func The function to cap arguments for.
15 * @param {number} [n=func.length] The arity cap.
16 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
17 * @returns {Function} Returns the new capped function.
18 * @example
19 *
20 * _.map(['6', '8', '10'], _.ary(parseInt, 1));
21 * // => [6, 8, 10]
22 */
23function ary(func, n, guard) {
24 n = guard ? undefined : n;
25 n = (func && n == null) ? func.length : n;
26 return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
27}
28
29export default ary;
Note: See TracBrowser for help on using the repository browser.