redux源码之compose

//官方compose,确保funcs是数组且长度大于一,不然就返回它
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)))
}

你可能感兴趣的:(redux源码之compose)