MCPcopy Index your code
hub / github.com/Effect-TS/effect / all

Function all

packages/effect/src/Either.ts:744–767  ·  view source on GitHub ↗
(
    input: Iterable<Either<any, any>> | Record<string, Either<any, any>>
  )

Source from the content-addressed store, hash-verified

742 { -readonly [K in keyof I]: [I[K]] extends [Either<infer A, any>] ? A : never },
743 I[keyof I] extends never ? never : [I[keyof I]] extends [Either<any, infer E>] ? E : never
744 > = (
745 input: Iterable<Either<any, any>> | Record<string, Either<any, any>>
746 ): Either<any, any> => {
747 if (Symbol.iterator in input) {
748 const out: Array<Either<any, any>> = []
749 for (const e of input) {
750 if (isLeft(e)) {
751 return e
752 }
753 out.push(e.right)
754 }
755 return right(out)
756 }
757
758 const out: Record<string, any> = {}
759 for (const key of Object.keys(input)) {
760 const e = input[key]
761 if (isLeft(e)) {
762 return e
763 }
764 out[key] = e.right
765 }
766 return right(out)
767 }
768
769/**
770 * Returns an `Either` that swaps the error/success cases. This allows you to

Callers

nothing calls this directly

Calls 3

keysMethod · 0.80
isLeftFunction · 0.50
rightFunction · 0.50

Tested by

no test coverage detected