MCPcopy Create free account
hub / github.com/arktypeio/arktype / initOf

Function initOf

ark/aot/graph.ts:7399–7409  ·  view source on GitHub ↗
(node: Node, module: SourceModule)

Source from the content-addressed store, hash-verified

7397 namedFunctionOf(node.parent, module) === node
7398
7399const initOf = (node: Node, module: SourceModule): Node | undefined => {
7400 const binding = module.scopes.byId.get(node)?.binding
7401 return (
7402 binding &&
7403 !binding.writes.length &&
7404 binding.declaration.type === "VariableDeclarator" &&
7405 binding.declaration.init
7406 ) ?
7407 unwrapExpression(binding.declaration.init)
7408 : undefined
7409}
7410
7411const compactTextOf = (node: Node, module: SourceModule) =>
7412 module.textOf(node).replace(/\s/g, "")

Callers 3

isSameReadMethod · 0.90
fixedDepthOfBindingMethod · 0.90
namedFunctionOfFunction · 0.70

Calls 2

unwrapExpressionFunction · 0.90
getMethod · 0.65

Tested by

no test coverage detected