MCPcopy
hub / github.com/Effect-TS/effect / all

Function all

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

Source from the content-addressed store, hash-verified

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