MCPcopy Create free account
hub / github.com/Effect-TS/effect / all

Function all

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

Source from the content-addressed store, hash-verified

1397 { -readonly [K in keyof I]: [I[K]] extends [Result<infer R, any>] ? R : never },
1398 I[keyof I] extends never ? never : [I[keyof I]] extends [Result<any, infer L>] ? L : never
1399 > = (
1400 input: Iterable<Result<any, any>> | Record<string, Result<any, any>>
1401 ): Result<any, any> => {
1402 if (Symbol.iterator in input) {
1403 const out: Array<Result<any, any>> = []
1404 for (const e of input) {
1405 if (isFailure(e)) {
1406 return e
1407 }
1408 out.push(e.success)
1409 }
1410 return succeed(out)
1411 }
1412
1413 const out: Record<string, any> = {}
1414 for (const key of Object.keys(input)) {
1415 const e = input[key]
1416 if (isFailure(e)) {
1417 return e
1418 }
1419 InternalRecord.assignProperty(out, key, e.success)
1420 }
1421 return succeed(out)
1422 }
1423
1424/**
1425 * Swaps the success and failure channels of a `Result`.

Callers

nothing calls this directly

Calls 3

pushMethod · 0.80
succeedFunction · 0.70
isFailureFunction · 0.50

Tested by

no test coverage detected