Real curry behavior in JavaScript
Switch branches/tags
Nothing to show
Latest commit 44fd66d May 29, 2013 @eborden Update
Failed to load latest commit information.

JavaScript Curry

Many JavaScript curry functions are actually implementations of partial application. This module implements true curry behavior in JavaScript.

True curry behavior means only accepting a single argument at a time and only executing upon application of all arguments. [citation]

curried = curry(function (a, b, c) {
	return a + b + c;
curried(1)(2)(3); //6

curriedOne = $curried(1);
curriedOne(2)(3); //6

Reverse Currying is also possible

curried = curry(function (a, b, c) {
	return a + b + c;
}, true);

//single argument convenience
curried = curry.r(function (a, b, c) {
	return a + b + c;

curried('a')('b')('c'); //'cba'


Tests are written in jasmine. They can be run at

To run from the command line:

npm install jasmine-node
jasmine-node path/to/js-curry