Created
March 15, 2016 18:42
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "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