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

Function parseValue

packages/effect/src/unstable/cli/internal/config.ts:146–171  ·  view source on GitHub ↗
(
    value: Param.Any | ReadonlyArray<Param.Any | Config> | Config
  )

Source from the content-addressed store, hash-verified

144 }
145
146 function parseValue(
147 value: Param.Any | ReadonlyArray<Param.Any | Config> | Config
148 ): ConfigInternal.Node {
149 if (Array.isArray(value)) {
150 return {
151 _tag: "Array",
152 children: (value as Array<any>).map((v) => parseValue(v))
153 }
154 } else if (Param.isParam(value)) {
155 const index = orderedParams.length
156 orderedParams.push(value)
157
158 if (value.kind === "argument") {
159 args.push(value as Param.AnyArgument)
160 } else {
161 flags.push(value as Param.AnyFlag)
162 }
163
164 return { _tag: "Param", index }
165 } else {
166 return {
167 _tag: "Nested",
168 tree: parse(value as Config)
169 }
170 }
171 }
172
173 return {
174 [ConfigInternalTypeId]: ConfigInternalTypeId,

Callers 1

parseFunction · 0.70

Calls 3

pushMethod · 0.80
parseFunction · 0.70
mapMethod · 0.45

Tested by

no test coverage detected