Guest User

Untitled

a guest
Jul 22nd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. const compose = (...fns) => {
  2.  
  3. function _compose(funcs, next, ...args) {
  4. const n = next(...args);
  5. return funcs.length ? _compose(funcs, funcs.pop(), n) : n;
  6. }
  7.  
  8. return (...args) => {
  9. const funcs = [...fns];
  10. return _compose(funcs, funcs.pop(), ...args)
  11. }
  12. }
Add Comment
Please, Sign In to add comment