function compose(...fns){
return function(...rest){
return fns.reduceRight(function(arg,fn){
return fn(arg)
},rest)
}
}
function pipeline(...fns){
return function(...rest){
return fns.reduce(function(arg,fn){
return fn(arg)
},rest)
}
}
原文:https://www.cnblogs.com/zhenjianyu/p/13602931.html