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

Function tuple

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

Source from the content-addressed store, hash-verified

619
620/** @internal */
621const tuple = <T extends ArrayLike<Config.Config<any>>>(tuple: T): Config.Config<
622 {
623 [K in keyof T]: [T[K]] extends [Config.Config<infer A>] ? A : never
624 }
625> => {
626 if (tuple.length === 0) {
627 return succeed([]) as any
628 }
629 if (tuple.length === 1) {
630 return map(tuple[0], (x) => [x]) as any
631 }
632 let result = map(tuple[0], (x) => [x])
633 for (let i = 1; i < tuple.length; i++) {
634 const config = tuple[i]
635 result = pipe(
636 result,
637 zipWith(config, (tuple, value) => [...tuple, value])
638 ) as any
639 }
640 return result as any
641}
642
643/**
644 * @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