pbojinov
10/19/2013 - 8:16 PM

Currying in javascript - https://medium.com/p/ce6da2d324fe

Currying in javascript - https://medium.com/p/ce6da2d324fe

var currier = function (fn) {
    var args = Array.prototype.slice.call(arguments, 1);

	return function() {
		return fn.apply(this, args.concat(Array.prototype.slice.call(arguments, 0)));
	};
};

var bye = function(str1, str2) {
	return str1.concat(' ').concat(str2);
};

var buhbye = currier(bye, 'thats\s all folks!');

buhbye('until next time!');