MCPcopy Create free account
hub / github.com/effect-app/libs / splitLinesArray

Function splitLinesArray

repos/effect/packages/effect/src/Channel.ts:6354–6403  ·  view source on GitHub ↗
(chunk: Arr.NonEmptyReadonlyArray<string>)

Source from the content-addressed store, hash-verified

6352 InErr1,
6353 InDone1,
6354 Env1
6355>(
6356 left: Channel<OutElem, OutErr, OutDone, InElem, InErr, InDone, Env>,
6357 right: Channel<OutElem1, OutErr1, OutDone1, InElem1, InErr1, InDone1, Env1>,
6358 options?: {
6359 readonly haltStrategy?: HaltStrategy | undefined
6360 } | undefined
6361): Channel<
6362 OutElem | OutElem1,
6363 OutErr | OutErr1,
6364 OutDone | OutDone1,
6365 InElem & InElem1,
6366 InErr & InErr1,
6367 InDone & InDone1,
6368 Env | Env1
6369> =>
6370 fromTransformBracket(Effect.fnUntraced(function*(upstream, _scope, forkedScope) {
6371 const strategy = options?.haltStrategy ?? "both"
6372 const queue = yield* Queue.bounded<OutElem | OutElem1, OutErr | OutErr1 | Cause.Done<OutDone | OutDone1>>(0)
6373 yield* Scope.addFinalizer(forkedScope, Queue.shutdown(queue))
6374 let done = 0
6375 function onExit(
6376 side: "left" | "right",
6377 cause: Cause.Cause<OutErr | OutErr1 | Cause.Done<OutDone | OutDone1>>
6378 ): Effect.Effect<void> {
6379 done++
6380 if (!Pull.isDoneCause(cause)) {
6381 return Queue.failCause(queue, cause)
6382 }
6383 switch (strategy) {
6384 case "both": {
6385 return done === 2 ? Queue.failCause(queue, cause) : Effect.void
6386 }
6387 case "left":
6388 case "right": {
6389 return side === strategy ? Queue.failCause(queue, cause) : Effect.void
6390 }
6391 case "either": {
6392 return Queue.failCause(queue, cause)
6393 }
6394 }
6395 }
6396 const runSide = (
6397 side: "left" | "right",
6398 channel: Channel<
6399 OutElem | OutElem1,
6400 OutErr | OutErr1,
6401 OutDone | OutDone1,
6402 InElem & InElem1,
6403 InErr & InErr1,
6404 InDone & InDone1,
6405 Env | Env1
6406 >,

Callers 1

loopFunction · 0.85

Calls 1

pushLineFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…