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

Function all

packages/effect/src/Micro.ts:3801–3826  ·  view source on GitHub ↗
(arg: Arg, options?: O)

Source from the content-addressed store, hash-verified

3799 * @category collecting & elements
3800 */
3801export const all = <
3802 const Arg extends Iterable<Micro<any, any, any>> | Record<string, Micro<any, any, any>>,
3803 O extends NoExcessProperties<{
3804 readonly concurrency?: Concurrency | undefined
3805 readonly discard?: boolean | undefined
3806 }, O>
3807>(arg: Arg, options?: O): All.Return<Arg, O> => {
3808 if (Array.isArray(arg) || isIterable(arg)) {
3809 return (forEach as any)(arg, identity, options)
3810 } else if (options?.discard) {
3811 return (forEach as any)(Object.values(arg), identity, options)
3812 }
3813 return suspend(() => {
3814 const out: Record<string, unknown> = {}
3815 return as(
3816 forEach(Object.entries(arg), ([key, effect]) =>
3817 map(effect, (value) => {
3818 out[key] = value
3819 }), {
3820 discard: true,
3821 concurrency: options?.concurrency
3822 }),
3823 out
3824 )
3825 }) as any
3826}
3827
3828/**
3829 * @since 3.11.0

Callers 1

Micro.tsFile · 0.70

Calls 7

isIterableFunction · 0.85
asFunction · 0.85
entriesMethod · 0.80
suspendFunction · 0.70
forEachFunction · 0.70
mapFunction · 0.70
valuesMethod · 0.45

Tested by

no test coverage detected