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

Function all

packages/effect/src/internal/fiberRuntime.ts:1976–2003  ·  view source on GitHub ↗
(
  arg: Arg,
  options?: O
)

Source from the content-addressed store, hash-verified

1974
1975/* @internal */
1976export const all = <
1977 const Arg extends Iterable<Effect.Effect<any, any, any>> | Record<string, Effect.Effect<any, any, any>>,
1978 O extends NoExcessProperties<{
1979 readonly concurrency?: Concurrency | undefined
1980 readonly batching?: boolean | "inherit" | undefined
1981 readonly discard?: boolean | undefined
1982 readonly mode?: "default" | "validate" | "either" | undefined
1983 readonly concurrentFinalizers?: boolean | undefined
1984 }, O>
1985>(
1986 arg: Arg,
1987 options?: O
1988): Effect.All.Return<Arg, O> => {
1989 const [effects, reconcile] = allResolveInput(arg)
1990
1991 if (options?.mode === "validate") {
1992 return allValidate(effects, reconcile, options) as any
1993 } else if (options?.mode === "either") {
1994 return allEither(effects, reconcile, options) as any
1995 }
1996
1997 return options?.discard !== true && reconcile._tag === "Some"
1998 ? core.map(
1999 forEach(effects, identity, options as any),
2000 reconcile.value
2001 ) as any
2002 : forEach(effects, identity, options as any) as any
2003}
2004
2005/* @internal */
2006export const allWith = <

Callers 3

allWithFunction · 0.70
allSuccessesFunction · 0.70
fiberRuntime.tsFile · 0.70

Calls 5

allResolveInputFunction · 0.85
allValidateFunction · 0.85
allEitherFunction · 0.85
forEachFunction · 0.70
mapMethod · 0.65

Tested by

no test coverage detected