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

Function hasProviderInput

packages/effect/src/Config.ts:701–717  ·  view source on GitHub ↗
(
  ast: SchemaAST.AST,
  node: ConfigProvider.Node | undefined
)

Source from the content-addressed store, hash-verified

699}
700
701const hasProviderInput = (
702 ast: SchemaAST.AST,
703 node: ConfigProvider.Node | undefined
704): boolean => {
705 switch (ast._tag) {
706 case "Objects":
707 return node?._tag === "Record"
708 case "Arrays":
709 return node?._tag === "Array"
710 case "Union":
711 return ast.types.some((ast) => hasProviderInput(ast, node))
712 case "Suspend":
713 return hasProviderInput(ast.thunk(), node)
714 default:
715 return node?.value !== undefined
716 }
717}
718
719const toConfigCursorAST = memoize((root: SchemaAST.AST): SchemaAST.AST => {
720 const seen = new WeakSet<SchemaAST.AST>()

Callers 1

schemaFunction · 0.85

Calls 1

someMethod · 0.80

Tested by

no test coverage detected