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

Function exportedFunctionNameOf

ark/aot/graph.ts:6301–6313  ·  view source on GitHub ↗
(
	fn: FunctionNode,
	module: SourceModule
)

Source from the content-addressed store, hash-verified

6299// the name a module exports a function as, e.g. `createEnv` for
6300// `export { createEnv }` or `export const createEnv = opts => ...`
6301const exportedFunctionNameOf = (
6302 fn: FunctionNode,
6303 module: SourceModule
6304): string | undefined => {
6305 for (const name in module.scopes.exportsByName) {
6306 const entry = module.scopes.exportsByName[name]
6307 const exported =
6308 entry.kind === "expression" ? unwrapExpression(entry.node)
6309 : entry.kind === "binding" ? functionOfBinding(entry.binding, module)
6310 : undefined
6311 if (exported === fn) return name
6312 }
6313}
6314
6315// what a declaration module declares a function's parameters as, e.g. for
6316// `declare function f(opts: Options): void`, `declare const f: (opts:

Callers 2

declaredParamKindOfMethod · 0.85
componentPropsParamOfMethod · 0.85

Calls 2

unwrapExpressionFunction · 0.90
functionOfBindingFunction · 0.85

Tested by

no test coverage detected