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

Function loop

packages/effect/src/internal/stream.ts:2268–2284  ·  view source on GitHub ↗
(r: number)

Source from the content-addressed store, hash-verified

2266 <A, E, R>(self: Stream.Stream<A, E, R>, n: number) => Stream.Stream<A, E, R>
2267>(2, <A, E, R>(self: Stream.Stream<A, E, R>, n: number): Stream.Stream<A, E, R> => {
2268 const loop = (r: number): Channel.Channel<Chunk.Chunk<A>, Chunk.Chunk<A>, never, never, unknown, unknown> =>
2269 core.readWith({
2270 onInput: (input: Chunk.Chunk<A>) => {
2271 const dropped = pipe(input, Chunk.drop(r))
2272 const leftover = Math.max(0, r - input.length)
2273 const more = Chunk.isEmpty(input) || leftover > 0
2274 if (more) {
2275 return loop(leftover)
2276 }
2277 return pipe(
2278 core.write(dropped),
2279 channel.zipRight(channel.identityChannel<Chunk.Chunk<A>, never, unknown>())
2280 )
2281 },
2282 onFailure: core.fail,
2283 onDone: () => core.void
2284 })
2285 return new StreamImpl(pipe(toChannel(self), channel.pipeToOrFail(loop(n))))
2286})
2287

Callers 10

releaseFunction · 0.70
stream.tsFile · 0.70
fromIteratorSucceedFunction · 0.70
paginateChunkFunction · 0.70
paginateChunkEffectFunction · 0.70
splitFunction · 0.70
throttleEnforceEffectFunction · 0.70
throttleShapeEffectFunction · 0.70
unfoldChunkFunction · 0.70
unfoldChunkEffectFunction · 0.70

Calls 15

syncMethod · 0.80
fromEffectMethod · 0.80
pipeFunction · 0.70
splitFunction · 0.70
isEmptyMethod · 0.65
writeMethod · 0.65
nextMethod · 0.65
mapMethod · 0.65
ofMethod · 0.65
makeMethod · 0.65
takeMethod · 0.65
zipMethod · 0.65

Tested by

no test coverage detected