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

Function tuple

packages/effect/src/internal/config.ts:608–628  ·  view source on GitHub ↗
(tuple: T)

Source from the content-addressed store, hash-verified

606
607/** @internal */
608const tuple = <T extends ArrayLike<Config.Config<any>>>(tuple: T): Config.Config<
609 {
610 [K in keyof T]: [T[K]] extends [Config.Config<infer A>] ? A : never
611 }
612> => {
613 if (tuple.length === 0) {
614 return succeed([]) as any
615 }
616 if (tuple.length === 1) {
617 return map(tuple[0], (x) => [x]) as any
618 }
619 let result = map(tuple[0], (x) => [x])
620 for (let i = 1; i < tuple.length; i++) {
621 const config = tuple[i]
622 result = pipe(
623 result,
624 zipWith(config, (tuple, value) => [...tuple, value])
625 ) as any
626 }
627 return result as any
628}
629
630/**
631 * @internal

Callers 1

allFunction · 0.70

Calls 4

zipWithFunction · 0.85
succeedFunction · 0.70
pipeFunction · 0.70
mapFunction · 0.50

Tested by

no test coverage detected