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

Function allTupled

packages/cli/src/internal/args.ts:474–491  ·  view source on GitHub ↗
(arg: T)

Source from the content-addressed store, hash-verified

472// =============================================================================
473
474const allTupled = <const T extends ArrayLike<Args.Args<any>>>(arg: T): Args.Args<
475 {
476 [K in keyof T]: [T[K]] extends [Args.Args<infer A>] ? A : never
477 }
478> => {
479 if (arg.length === 0) {
480 return none as any
481 }
482 if (arg.length === 1) {
483 return map(arg[0], (x) => [x]) as any
484 }
485 let result = map(arg[0], (x) => [x])
486 for (let i = 1; i < arg.length; i++) {
487 const curr = arg[i]
488 result = map(makeBoth(result, curr), ([a, b]) => [...a, b])
489 }
490 return result as any
491}
492
493const getHelpInternal = (self: Instruction): HelpDoc.HelpDoc => {
494 switch (self._tag) {

Callers 1

allFunction · 0.70

Calls 2

makeBothFunction · 0.70
mapFunction · 0.50

Tested by

no test coverage detected