caminho
Version:
Tool for creating efficient data pipelines in a JavaScript environment
16 lines • 732 B
JavaScript
export function getNewValueBag(oldValueBag, toProvide, newValue) {
return { ...oldValueBag, [toProvide]: newValue };
}
export function buildValueBagAccumulator(pipesParams) {
const providablePipeParams = pipesParams.filter((pipeParams) => pipeParams.provides);
return function getAccumulatedParallelBag(valueBags) {
function accumulateParallelProvidedValues(valueBag, pipeParams, index) {
if (pipeParams.provides) {
valueBag[pipeParams.provides] = valueBags[index][pipeParams.provides];
}
return valueBag;
}
return providablePipeParams.reduce(accumulateParallelProvidedValues, { ...valueBags[0] });
};
}
//# sourceMappingURL=valueBag.js.map