MCPcopy Create free account
hub / github.com/Snapchat/Valdi / findComponentClassName

Function findComponentClassName

npm_modules/cli/src/core/analyze/parser.ts:57–74  ·  view source on GitHub ↗
(sourceFile: ts.SourceFile)

Source from the content-addressed store, hash-verified

55}
56
57function findComponentClassName(sourceFile: ts.SourceFile): string | undefined {
58 for (const statement of sourceFile.statements) {
59 if (!ts.isClassDeclaration(statement) || !statement.name) continue;
60
61 if (statement.heritageClauses) {
62 for (const clause of statement.heritageClauses) {
63 if (clause.token !== ts.SyntaxKind.ExtendsKeyword) continue;
64 for (const type of clause.types) {
65 const text = type.expression.getText(sourceFile);
66 if (text === 'Component' || text === 'StatefulComponent') {
67 return statement.name.text;
68 }
69 }
70 }
71 }
72 }
73 return undefined;
74}
75
76function extractViewModelProps(sourceFile: ts.SourceFile): string[] {
77 const props: string[] = [];

Callers 1

parseFileFunction · 0.85

Calls 1

getTextMethod · 0.65

Tested by

no test coverage detected