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

Function zip

packages/effect/src/internal/stream.ts:8256–8276  ·  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

8254 }
8255 }
8256 const zip = (
8257 leftChunk: Chunk.Chunk<A>,
8258 rightChunk: Chunk.Chunk<A2>,
8259 f: (a: A, a2: A2) => A3
8260 ): readonly [Chunk.Chunk<A3>, ZipAllState.ZipAllState<A, A2>] => {
8261 const [output, either] = zipChunks(leftChunk, rightChunk, f)
8262 switch (either._tag) {
8263 case "Left": {
8264 if (Chunk.isEmpty(either.left)) {
8265 return [output, ZipAllState.PullBoth] as const
8266 }
8267 return [output, ZipAllState.PullRight(either.left)] as const
8268 }
8269 case "Right": {
8270 if (Chunk.isEmpty(either.right)) {
8271 return [output, ZipAllState.PullBoth] as const
8272 }
8273 return [output, ZipAllState.PullLeft(either.right)] as const
8274 }
8275 }
8276 }
8277 return combineChunks(self, options.other, ZipAllState.PullBoth, pull)
8278 }
8279)

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