Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. const curry = (fn) => {
  2. return function curried(...args) {
  3. const done = args.length >= fn.length
  4. if (done) {
  5. return fn.apply(this, args)
  6. } else {
  7. return (...args2) => curried.apply(this, [...args, ...args2])
  8. }
  9. }
  10. }
  11.  
  12. // This is invalid because it uses ...args. The curry does not understand where to stop
  13. function func(...args) {
  14. //
  15. }
  16.  
  17. const currying = curry(func)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement