Skip to content

Instantly share code, notes, and snippets.

View trustedtomato's full-sized avatar

Tamás Halasi trustedtomato

  • Hungary, Budapest
View GitHub Profile
@trustedtomato
trustedtomato / curry.js
Last active August 25, 2017 17:58
Javascript ES6 currying
function curry(fn){
const len = fn.length;
const next = oldArgs => (...newArgs) => {
const args = oldArgs.concat(newArgs);
return (args.length >= len)
? fn.apply(this, args)
: next(args);
};
return next([]);
};