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

Function modifySingle

packages/cli/src/internal/options.ts:1078–1117  ·  view source on GitHub ↗
(self: Instruction, f: (single: Single) => Single)

Source from the content-addressed store, hash-verified

1076}
1077
1078const modifySingle = (self: Instruction, f: (single: Single) => Single): Options.Options<any> => {
1079 switch (self._tag) {
1080 case "Empty": {
1081 return none
1082 }
1083 case "Single": {
1084 return f(self)
1085 }
1086 case "KeyValueMap": {
1087 return makeKeyValueMap(f(self.argumentOption))
1088 }
1089 case "Map": {
1090 return makeMap(modifySingle(self.options as Instruction, f), self.f)
1091 }
1092 case "Both": {
1093 return makeBoth(
1094 modifySingle(self.left as Instruction, f),
1095 modifySingle(self.right as Instruction, f)
1096 )
1097 }
1098 case "OrElse": {
1099 return makeOrElse(
1100 modifySingle(self.left as Instruction, f),
1101 modifySingle(self.right as Instruction, f)
1102 )
1103 }
1104 case "Variadic": {
1105 return makeVariadic(f(self.argumentOption), self.min, self.max)
1106 }
1107 case "WithDefault": {
1108 return makeWithDefault(modifySingle(self.options as Instruction, f), self.fallback)
1109 }
1110 case "WithFallback": {
1111 return makeWithFallback(
1112 modifySingle(self.options as Instruction, f),
1113 self.effect
1114 )
1115 }
1116 }
1117}
1118
1119/** @internal */
1120export const getNames = (self: Instruction): Array<string> => {

Callers 1

options.tsFile · 0.85

Calls 8

makeKeyValueMapFunction · 0.85
makeOrElseFunction · 0.85
makeWithFallbackFunction · 0.85
makeMapFunction · 0.70
makeBothFunction · 0.70
makeVariadicFunction · 0.70
makeWithDefaultFunction · 0.70
fFunction · 0.50

Tested by

no test coverage detected