| /** |
| * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/> |
| * Build: `lodash modularize exports="node" -o ./compat/` |
| * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/> |
| * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE> |
| * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors |
| * Available under MIT license <http://lodash.com/license> |
| */ |
| var createWrapper = require('../internals/createWrapper'); |
| |
| /** |
| * Creates a function which accepts one or more arguments of `func` that when |
| * invoked either executes `func` returning its result, if all `func` arguments |
| * have been provided, or returns a function that accepts one or more of the |
| * remaining `func` arguments, and so on. The arity of `func` can be specified |
| * if `func.length` is not sufficient. |
| * |
| * @static |
| * @memberOf _ |
| * @category Functions |
| * @param {Function} func The function to curry. |
| * @param {number} [arity=func.length] The arity of `func`. |
| * @returns {Function} Returns the new curried function. |
| * @example |
| * |
| * var curried = _.curry(function(a, b, c) { |
| * console.log(a + b + c); |
| * }); |
| * |
| * curried(1)(2)(3); |
| * // => 6 |
| * |
| * curried(1, 2)(3); |
| * // => 6 |
| * |
| * curried(1, 2, 3); |
| * // => 6 |
| */ |
| function curry(func, arity) { |
| arity = typeof arity == 'number' ? arity : (+arity || func.length); |
| return createWrapper(func, 4, null, null, null, arity); |
| } |
| |
| module.exports = curry; |