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

Function switch

packages/effect/src/Schema.ts:15097–15111  ·  view source on GitHub ↗
(ast._tag)

Source from the content-addressed store, hash-verified

15095
15096function toCodecIsoASTStep(ast: SchemaAST.AST, recur: (ast: SchemaAST.AST) => SchemaAST.AST): SchemaAST.AST {
15097 switch (ast._tag) {
15098 case "Declaration": {
15099 const getLink = ast.annotations?.toCodecIso ?? ast.annotations?.toCodec
15100 if (Predicate.isFunction(getLink)) {
15101 const link = getLink(ast.typeParameters.map((tp) => InternalSchema.make(tp)))
15102 return SchemaAST.replaceEncoding(ast, [SchemaAST.mapLink(link, recur)])
15103 }
15104 return ast
15105 }
15106 case "Arrays":
15107 case "Objects":
15108 case "Union":
15109 case "Suspend":
15110 return ast.recur(recur)
15111 }
15112 return ast
15113}
15114

Callers 1

Function.tsFile · 0.70

Calls 3

makeMethod · 0.65
mapMethod · 0.45
recurMethod · 0.45

Tested by

no test coverage detected