MCPcopy Index your code
hub / github.com/Effect-TS/effect / forEachParN

Function forEachParN

packages/effect/src/internal/fiberRuntime.ts:2405–2416  ·  view source on GitHub ↗
(
  self: Iterable<A>,
  n: number,
  f: (a: A, i: number) => Effect.Effect<B, E, R>,
  batching: boolean
)

Source from the content-addressed store, hash-verified

2403
2404/* @internal */
2405export const forEachParN = <A, B, E, R>(
2406 self: Iterable<A>,
2407 n: number,
2408 f: (a: A, i: number) => Effect.Effect<B, E, R>,
2409 batching: boolean
2410): Effect.Effect<Array<B>, E, R> =>
2411 core.suspend(() => {
2412 const as = RA.fromIterable(self)
2413 const array = new Array<B>(as.length)
2414 const fn = (a: A, i: number) => core.map(f(a, i), (b) => array[i] = b)
2415 return core.zipRight(forEachConcurrentDiscard(as, fn, batching, false, n), core.succeed(array))
2416 })
2417
2418/* @internal */
2419export const fork = <A, E, R>(self: Effect.Effect<A, E, R>): Effect.Effect<Fiber.RuntimeFiber<A, E>, never, R> =>

Callers 2

fiberRuntime.tsFile · 0.85
closeFunction · 0.85

Calls 1

forEachConcurrentDiscardFunction · 0.85

Tested by

no test coverage detected