MCPcopy Create free account
hub / github.com/Effect-TS/effect / zip

Function zip

packages/effect/src/internal/stream.ts:8294–8314  ·  view source on GitHub ↗
(
      leftChunk: Chunk.Chunk<A>,
      rightChunk: Chunk.Chunk<A2>,
      f: (a: A, a2: A2) => A3
    )

Source from the content-addressed store, hash-verified

8292 }
8293 }
8294 const zip = (
8295 leftChunk: Chunk.Chunk<A>,
8296 rightChunk: Chunk.Chunk<A2>,
8297 f: (a: A, a2: A2) => A3
8298 ): readonly [Chunk.Chunk<A3>, ZipAllState.ZipAllState<A, A2>] => {
8299 const [output, either] = zipChunks(leftChunk, rightChunk, f)
8300 switch (either._tag) {
8301 case "Left": {
8302 if (Chunk.isEmpty(either.left)) {
8303 return [output, ZipAllState.PullBoth] as const
8304 }
8305 return [output, ZipAllState.PullRight(either.left)] as const
8306 }
8307 case "Right": {
8308 if (Chunk.isEmpty(either.right)) {
8309 return [output, ZipAllState.PullBoth] as const
8310 }
8311 return [output, ZipAllState.PullLeft(either.right)] as const
8312 }
8313 }
8314 }
8315 return combineChunks(self, options.other, ZipAllState.PullBoth, pull)
8316 }
8317)

Callers 3

logger.tsFile · 0.70
pullFunction · 0.70
channel.tsFile · 0.70

Calls 3

zipChunksFunction · 0.85
isEmptyMethod · 0.65
fFunction · 0.50

Tested by

no test coverage detected