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

Function extractStateProps

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

Source from the content-addressed store, hash-verified

93}
94
95function extractStateProps(sourceFile: ts.SourceFile): string[] {
96 const props: string[] = [];
97
98 for (const statement of sourceFile.statements) {
99 if (!ts.isInterfaceDeclaration(statement)) continue;
100 const name = statement.name.text;
101 if (!name.endsWith('State') && !name.includes('State')) continue;
102 if (name.endsWith('ViewModel') || name.endsWith('VM')) continue;
103
104 for (const member of statement.members) {
105 if (ts.isPropertySignature(member) && member.name && ts.isIdentifier(member.name)) {
106 props.push(member.name.text);
107 }
108 }
109 if (props.length > 0) break;
110 }
111
112 return props;
113}
114
115function extractRenderElements(sourceFile: ts.SourceFile): string[] {
116 const elements: string[] = [];

Callers 1

parseFileFunction · 0.85

Calls 2

isIdentifierMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected