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

Function extractViewModelProps

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

Source from the content-addressed store, hash-verified

74}
75
76function extractViewModelProps(sourceFile: ts.SourceFile): string[] {
77 const props: string[] = [];
78
79 for (const statement of sourceFile.statements) {
80 if (!ts.isInterfaceDeclaration(statement)) continue;
81 const name = statement.name.text;
82 if (!name.endsWith('ViewModel') && !name.endsWith('VM') && !name.endsWith('Props')) continue;
83
84 for (const member of statement.members) {
85 if (ts.isPropertySignature(member) && member.name && ts.isIdentifier(member.name)) {
86 props.push(member.name.text);
87 }
88 }
89 if (props.length > 0) break;
90 }
91
92 return props;
93}
94
95function extractStateProps(sourceFile: ts.SourceFile): string[] {
96 const props: string[] = [];

Callers 1

parseFileFunction · 0.85

Calls 2

isIdentifierMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected