How can I implement the following code using Observables in rxjs?
What I am trying to achieve here is that I have an array of functions, each of which accepts an object, modifies it and returns the object to the next function in the stack.
function A(res:SomeType){
//Do Something
return res;
}
function B(res:SomeType){
//Do Something
return res;
}
function C(res:SomeType){
//Do Something
return res;
}
let fnPipe = [];
fnPipe.push(A);
fnPipe.push(B);
fnPipe.push(C);
obj= {key:"val"};
fnPipe.forEach((fn)=>{
obj= fn(obj);
});
console.log(obj);
How can I implement the same using observables in rxjs?