Created
May 14, 2023 06:13
-
-
Save Tribhuwan-Joshi/2e8615eb8fbf85f3dcd8c00d2773624e to your computer and use it in GitHub Desktop.
Smooth currying in JS
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
const curry = function (fn){ | |
return function currying(...args){ | |
if(args.length >= fn.length ){ | |
return fn(...args); | |
} | |
else { | |
return function(...args2){ | |
return currying.apply(...args.concat(args2)) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment