MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / hasNamespace

Function hasNamespace

src/resolution/import-resolver.ts:3146–3148  ·  view source on GitHub ↗

Whether `file` declares the namespace `path`, itself or as the prefix of a longer one (`namespace A.B` declares `A`).

(file: string, path: string, context: ResolutionContext)

Source from the content-addressed store, hash-verified

3144
3145/** Whether `file` declares the namespace `path`, itself or as the prefix of a longer one (`namespace A.B` declares `A`). */
3146function hasNamespace(file: string, path: string, context: ResolutionContext): boolean {
3147 return namespaceBlocks(file, context).some((b) => b.path === path || b.path.startsWith(`${path}.`));
3148}
3149
3150/** The innermost namespace block a node starts in. */
3151function innermostBlock(node: Pick<Node, 'startLine' | 'startColumn'>, blocks: readonly NamespaceBlock[]): NamespaceBlock | undefined {

Callers 2

ownTypeMemberFunction · 0.85
typeMemberInFunction · 0.85

Calls 1

namespaceBlocksFunction · 0.90

Tested by

no test coverage detected