Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function curry(fn) {
- return function curried() {
- const args = Array.prototype.slice.call(arguments)
- const done = args.length >= fn.length
- if (done) {
- return fn.apply(this, args)
- } else {
- return function() {
- const args2 = Array.prototype.slice.call(arguments)
- return curried.apply(this, args.concat(args2))
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement