compose

作者: 深度_1175 | 来源:发表于2019-09-27 14:49 被阅读0次

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

      本文链接:https://www.haomeiwen.com/subject/rqoeuctx.html