Last active
January 28, 2020 07:28
-
-
Save SpencerAung/079d3d1c37e0d90bad30e60c15c410a4 to your computer and use it in GitHub Desktop.
Curry function implementation in ES2015
This file contains 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
function curry(fn) { | |
return (...args) => { | |
if (args.length >= fn.length) { | |
return fn(...args) | |
} | |
return curry(fn.bind(null,...args)) | |
} | |
} | |
export default curry |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment