读的比拟好的一篇文章:
https://www.jianshu.com/p/c9d…
export default function compose(...funcs) {if (funcs.length === 0) {return arg => arg}
if (funcs.length === 1) {return funcs[0]
}
return funcs.reduce((a, b) => (...args) => a(b(...args)))
}
compose(f1, f2, f3, f4)(args)
执行程序是:f1(f2(f3(f4(args))))