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

Function zipChunks

packages/effect/src/internal/stream.ts:8672–8687  ·  view source on GitHub ↗
(
  left: Chunk.Chunk<A>,
  right: Chunk.Chunk<B>,
  f: (a: A, b: B) => C
)

Source from the content-addressed store, hash-verified

8670
8671/** @internal */
8672const zipChunks = <A, B, C>(
8673 left: Chunk.Chunk<A>,
8674 right: Chunk.Chunk<B>,
8675 f: (a: A, b: B) => C
8676): [Chunk.Chunk<C>, Either.Either<Chunk.Chunk<B>, Chunk.Chunk<A>>] => {
8677 if (left.length > right.length) {
8678 return [
8679 pipe(left, Chunk.take(right.length), Chunk.zipWith(right, f)),
8680 Either.left(pipe(left, Chunk.drop(right.length)))
8681 ]
8682 }
8683 return [
8684 pipe(left, Chunk.zipWith(pipe(right, Chunk.take(left.length)), f)),
8685 Either.right(pipe(right, Chunk.drop(left.length)))
8686 ]
8687}
8688
8689// Do notation
8690

Callers 2

zipFunction · 0.85
stream.tsFile · 0.85

Calls 2

pipeFunction · 0.70
takeMethod · 0.65

Tested by

no test coverage detected