combine
Validate many results and return a new one
You must have wondered if you have a chain of results, how to validate all. For that there is the "combine". It receives an array of Result and validate all returning a new one.
const resultA = Result.success<void>();
const resultB = Result.fail<void>("this is error B");
const resultC = Result.ok<number>(1);
const isSomeFail = Result.combine([resultA, resultB, resultC])
console.log(isSomeFail.isFailure);
> true
Last updated
Was this helpful?