Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const curry = (fn) => {
- return function curried(...args) {
- const done = args.length >= fn.length
- if (done) {
- return fn.apply(this, args)
- } else {
- return (...args2) => curried.apply(this, [...args, ...args2])
- }
- }
- }
- // This is invalid because it uses ...args. The curry does not understand where to stop
- function func(...args) {
- //
- }
- const currying = curry(func)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement