It feels like a bad practice to rely on an outer scoped object for holding arguments I pass to my promise. Is there a better way to do this that does not rely on the "builder"'s scope.
The code provided accomplished my objective, but it relies on the outer scope of the "builder" object.
funct1-4 are all promises
let builder = {}
funct1()
.then(a =>{
builder.a = a;
// funct2 needs a
return funct2(builder)
})
.then(b => {
builder.b = b;
// funct3 needs a,b
return funct3(builder)
})
.then(c =>{
builder.c = c;
// funct4 needs a,b,c
funct4(builder)
})