Skip to content

Instantly share code, notes, and snippets.

@ethansnow2012
Last active November 21, 2023 09:10
Show Gist options
  • Save ethansnow2012/22a116f44c722170d8f50ffebe376868 to your computer and use it in GitHub Desktop.
Save ethansnow2012/22a116f44c722170d8f50ffebe376868 to your computer and use it in GitHub Desktop.
/**
* currying wrapper function that is magical
**/
function curry(f) {
function curried(args) {
if (args.length >= f.length) return f(...args);
return accumulator;
function accumulator(a) {
return curried([...args, a]);
};
};
return curried([]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment