1 var createWrapper = require('./internal/createWrapper');
3 /** Used to compose bitmasks for wrapper metadata. */
7 * Creates a function that accepts arguments of `func` and either invokes
8 * `func` returning its result, if at least `arity` number of arguments have
9 * been provided, or returns a function that accepts the remaining `func`
10 * arguments, and so on. The arity of `func` may be specified if `func.length`
13 * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
14 * may be used as a placeholder for provided arguments.
16 * **Note:** This method doesn't set the "length" property of curried functions.
21 * @param {Function} func The function to curry.
22 * @param {number} [arity=func.length] The arity of `func`.
23 * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`.
24 * @returns {Function} Returns the new curried function.
27 * var abc = function(a, b, c) {
31 * var curried = _.curry(abc);
42 * // using placeholders
43 * curried(1)(_, 3)(2);
46 function curry(func, arity, guard) {
47 arity = guard ? undefined : arity;
48 var result = createWrapper(func, CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
49 result.placeholder = curry.placeholder;
53 module.exports = curry;