Just one more utility, no breaking changes added đ§ââď¸
Ps
When one of the domain functions result does not conform R extends Record<any, any> the merge will return an ErrorResult with the following error message: "Invalid data format returned from some domainFunction"
Reasoning
In our projects, composing functions with
all
is becoming more and more of a pattern.The problem is that when we have long tuples it is harder to keep track of the variable names:
This problem has led us to start always returning an object as the result of a DF so we have named variables:
When following this pattern we had the idea to start merging the resulting tuple into one big object with named keys.
This new
merge
function will change the code above to:Just one more utility, no breaking changes added đ§ââď¸
Ps
When one of the domain functions result does not conform
R extends Record<any, any>
themerge
will return anErrorResult
with the following error message:"Invalid data format returned from some domainFunction"