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

Function foldChunkSplit

packages/effect/src/internal/sink.ts:840–856  ·  view source on GitHub ↗
(
  s: S,
  chunk: Chunk.Chunk<In>,
  contFn: Predicate<S>,
  f: (z: S, input: In) => S,
  index: number,
  length: number
)

Source from the content-addressed store, hash-verified

838
839/** @internal */
840const foldChunkSplit = <S, In>(
841 s: S,
842 chunk: Chunk.Chunk<In>,
843 contFn: Predicate<S>,
844 f: (z: S, input: In) => S,
845 index: number,
846 length: number
847): [S, Chunk.Chunk<In>] => {
848 if (index === length) {
849 return [s, Chunk.empty()]
850 }
851 const s1 = f(s, pipe(chunk, Chunk.unsafeGet(index)))
852 if (contFn(s1)) {
853 return foldChunkSplit(s1, chunk, contFn, f, index + 1, length)
854 }
855 return [s1, pipe(chunk, Chunk.drop(index + 1))]
856}
857
858/** @internal */
859export const foldSink = dual<

Callers 1

foldReaderFunction · 0.85

Calls 3

unsafeGetMethod · 0.80
pipeFunction · 0.70
fFunction · 0.50

Tested by

no test coverage detected