The Wayback Machine - https://web.archive.org/web/20170626172351/https://github.com/lodash/lodash/blob/master/ary.js
Skip to content
Permalink
Fetching contributors…
Cannot retrieve contributors at this time
26 lines (22 sloc) 713 Bytes
import createWrap from './.internal/createWrap.js'
/** Used to compose bitmasks for function metadata. */
const WRAP_ARY_FLAG = 128
/**
* Creates a function that invokes `func`, with up to `n` arguments,
* ignoring any additional arguments.
*
* @since 3.0.0
* @category Function
* @param {Function} func The function to cap arguments for.
* @param {number} [n=func.length] The arity cap.
* @returns {Function} Returns the new capped function.
* @example
*
* map(['6', '8', '10'], ary(parseInt, 1))
* // => [6, 8, 10]
*/
function ary(func, n) {
n = (func && n == null) ? func.length : n
return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n)
}
export default ary
You can't perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.