Created
June 14, 2012 21:28
Revisions
-
athieriot created this gist
Jun 14, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ #!/usr/bin/env node //Declare curry method on every functions Function.prototype.curry = function(arg1) { //Keeping this just for later var self = this; //Keeping curried arg in the scope of the new function var arg1 = arg1; //Defining the new function which take one less parameter return function(arg2) { //Calling the original function with every parameters self.call(self, arg1, arg2); } } //One origin function taking to parameters and display them var testFunction = function(un, deux) { console.log(un + ' ' + deux); } //Indian spice var testFunctionUn = testFunction.curry('un'); //That should display 'un - deux' testFunctionUn('deux');