added _.curry definition

This commit is contained in:
Brian Zengel
2013-10-18 23:06:21 -04:00
parent 2fabed36e4
commit 5878ecbd3e
2 changed files with 22 additions and 0 deletions
+8
View File
@@ -443,6 +443,14 @@ var createCallbackObj = { name: 'Joe' };
var pluckCallback: () => any = _.createCallback('name');
var whereCallback: () => boolean = _.createCallback(createCallbackObj);
var curried: Function = _.curry(function(a, b, c) {
console.log(a + b + c);
});
curried(1)(2)(3);
curried(1, 2)(3);
curried(1, 2, 3);
////////////////////////////////////////////////////////////////////////////////////////
//WHAT'S LEFT
+14
View File
@@ -1780,6 +1780,20 @@ declare module _ {
thisArg?: any,
argCount?: number): () => boolean;
/**
* 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.
* @param func The function to curry.
* @param arity The arity of func.
* @return The new curried function.
**/
export function curry(
func: Function,
arity?: number): Function;