function pipe(src, ...fns){
return fns.reduce(function(fn1, fn2){
return fn2(fn1)
}, src);
}
undefined
pipe("aaa",function(p){console.log(p); return p+"bbb"},function(p){console.log(p); return p+"ccc"})
VM1460:1 aaa
VM1460:1 aaabbb
"aaabbbccc"
function pipe(src, ...fns){
return fns.reduce(function(fn1, fn2){
return fn2(fn1)
}, src);
}
undefined
pipe("aaa",function(p){console.log(p); return p+"bbb"},function(p){console.log(p); return p+"ccc"})
VM1460:1 aaa
VM1460:1 aaabbb
"aaabbbccc"