How do you curry any javascript function of arbitrary arity?
问题 Let's say I have some function: function g(a,b,c){ return a + b + c } And I'd like to turn it into its "curried" form (in quotations since it's not exactly curried per se): function h(a,b,c){ switch(true){ case (a !== undefined && b !== undefined && c !== undefined): return a + b + c case (a !== undefined && b !== undefined && c === undefined): return function(c){ return a + b + c } case (a !== undefined && b == undefined && c === undefined ): return function(b,c){ return (c === undefined) ?