/** * Zip combining errors in case of multiple failures. * * @tsplus static Either.Ops zipValidation */ export function zipValidation(S: Associative) { return (fa: Either, fb: Either): Either => fa.fold( (ea) => fb.fold( (eb) => Either.left(S.combine(ea, eb)), () => Either.left(ea) ), (a) => fb.fold(Either.left, (b) => Either.right([a, b])) ) }