Skip to content

Instantly share code, notes, and snippets.

@ethanjurman
Created March 15, 2016 18:42
Show Gist options
  • Select an option

  • Save ethanjurman/27b8bd20708c1850dedc to your computer and use it in GitHub Desktop.

Select an option

Save ethanjurman/27b8bd20708c1850dedc to your computer and use it in GitHub Desktop.
This is a extremely simple way to curry a given function in javascript.
"use strict";
function makeCurry(func, context) {
let curryFunc = func;
for (let i = func.length; i > 1; i--) {
curryFunc = Function.bind.bind(curryFunc, context);
}
return curryFunc;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment