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

Function getMaxSizeInternal

packages/cli/src/internal/args.ts:621–644  ·  view source on GitHub ↗
(self: Instruction)

Source from the content-addressed store, hash-verified

619}
620
621const getMaxSizeInternal = (self: Instruction): number => {
622 switch (self._tag) {
623 case "Empty": {
624 return 0
625 }
626 case "Single": {
627 return 1
628 }
629 case "Map":
630 case "WithDefault":
631 case "WithFallbackConfig": {
632 return getMaxSizeInternal(self.args as Instruction)
633 }
634 case "Both": {
635 const leftMaxSize = getMaxSizeInternal(self.left as Instruction)
636 const rightMaxSize = getMaxSizeInternal(self.right as Instruction)
637 return leftMaxSize + rightMaxSize
638 }
639 case "Variadic": {
640 const argsMaxSize = getMaxSizeInternal(self.args as Instruction)
641 return Math.floor(Option.getOrElse(self.max, () => Number.MAX_SAFE_INTEGER / 2) * argsMaxSize)
642 }
643 }
644}
645
646const getUsageInternal = (self: Instruction): Usage.Usage => {
647 switch (self._tag) {

Callers 3

getMaxSizeFunction · 0.70
getHelpInternalFunction · 0.70
wizardInternalFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected