Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. function curry(fn) {
  2. return function curried() {
  3. const args = Array.prototype.slice.call(arguments)
  4. const done = args.length >= fn.length
  5. if (done) {
  6. return fn.apply(this, args)
  7. } else {
  8. return function() {
  9. const args2 = Array.prototype.slice.call(arguments)
  10. return curried.apply(this, args.concat(args2))
  11. }
  12. }
  13. }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement