Skip to content

Instantly share code, notes, and snippets.

@thebiltheory
Created December 19, 2017 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thebiltheory/9e4b7616a0570118187054af1e8119bf to your computer and use it in GitHub Desktop.
Save thebiltheory/9e4b7616a0570118187054af1e8119bf to your computer and use it in GitHub Desktop.
Add some curry to your functions
let curry = function (tocurry) {
const params = Array.prototype.slice.call(arguments, 1);
return function () {
return tocurry.apply(this, params.concat(
Array.prototype.slice.call(arguments, 0)
));
};
};
function cookin (what, sauce, who) {
return `Been ${what}' with the sauce,
Chef ${who} with the pot, boy`
};
const letsCookin = curry(cookin, 'cookin');
letsCookin('Curry');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment