compose合并函数依次执行 - 来源redux

1 function compose(...funcs) {
2   if (funcs.length === 0) {
3     return arg => arg
4   }
5   if (funcs.length === 1) {
6     return funcs[0]
7   }
8   return funcs.reduce((a, b) => (...args) => a(b(...args)))
9 }

猜你喜欢

转载自www.cnblogs.com/wwwweb/p/8919365.html