MCPcopy
hub / github.com/Effect-TS/effect / dropLoop

Function dropLoop

packages/effect/src/internal/sink.ts:550–568  ·  view source on GitHub ↗
(
  n: number
)

Source from the content-addressed store, hash-verified

548
549/** @internal */
550const dropLoop = <In>(
551 n: number
552): Channel.Channel<Chunk.Chunk<In>, Chunk.Chunk<In>, never, never, unknown, unknown> =>
553 core.readWith({
554 onInput: (input: Chunk.Chunk<In>) => {
555 const dropped = pipe(input, Chunk.drop(n))
556 const leftover = Math.max(n - input.length, 0)
557 const more = Chunk.isEmpty(input) || leftover > 0
558 if (more) {
559 return dropLoop(leftover)
560 }
561 return pipe(
562 core.write(dropped),
563 channel.zipRight(channel.identityChannel<Chunk.Chunk<In>, never, unknown>())
564 )
565 },
566 onFailure: core.fail,
567 onDone: () => core.void
568 })
569
570/** @internal */
571export const dropUntil = <In>(predicate: Predicate<In>): Sink.Sink<unknown, In, In> =>

Callers 1

dropFunction · 0.85

Calls 3

pipeFunction · 0.70
isEmptyMethod · 0.65
writeMethod · 0.65

Tested by

no test coverage detected