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

Function hasNamespace

src/resolution/import-resolver.ts:3247–3249  ·  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

3245
3246/** Whether `file` declares the namespace `path`, itself or as the prefix of a longer one (`namespace A.B` declares `A`). */
3247function hasNamespace(file: string, path: string, context: ResolutionContext): boolean {
3248 return namespaceBlocks(file, context).some((b) => b.path === path || b.path.startsWith(`${path}.`));
3249}
3250
3251/** The innermost namespace block a node starts in. */
3252function innermostBlock(node: Pick<Node, 'startLine' | 'startColumn'>, blocks: readonly NamespaceBlock[]): NamespaceBlock | undefined {

Callers 3

ownTypeMemberFunction · 0.85
typeMemberInFunction · 0.85
resolveViaImportFunction · 0.85

Calls 1

namespaceBlocksFunction · 0.90

Tested by

no test coverage detected