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

Function stripEncoding

packages/effect/src/SchemaAST.ts:4790–4801  ·  view source on GitHub ↗
(ast: A)

Source from the content-addressed store, hash-verified

4788})
4789
4790function stripEncoding<A extends AST>(ast: A): A {
4791 const cached = types.get(ast)
4792 if (cached) return cached as A
4793 const source = flippedFrom.get(ast)
4794 const wasProjected = source && types.get(source) === source
4795 const out = source && reversed.get(source) || projectType(ast)
4796 if (wasProjected) reversed.set(source, out)
4797 types.set(ast, out)
4798 // Projected nodes map to themselves, so the cache also identifies completed projections.
4799 if (out !== ast) types.set(out, out)
4800 return out as A
4801}
4802
4803function projectOwner<A extends AST>(ast: A, project: (ast: A) => AST): A | undefined {
4804 const owner = getContextOwner(ast)

Callers 3

toTypeFunction · 0.85
SchemaAST.tsFile · 0.85
reverseBodyFunction · 0.85

Calls 3

projectTypeFunction · 0.85
getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected