| 3798 | * @category collecting & elements |
| 3799 | */ |
| 3800 | export 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 |