Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const compose = (...fns) => {
- function _compose(funcs, next, ...args) {
- const n = next(...args);
- return funcs.length ? _compose(funcs, funcs.pop(), n) : n;
- }
- return (...args) => {
- const funcs = [...fns];
- return _compose(funcs, funcs.pop(), ...args)
- }
- }
Add Comment
Please, Sign In to add comment