MCPcopy Create free account
hub / github.com/TanStack/ai / parseNames

Function parseNames

testing/react-native-smoke/scripts/assert-import-surface.ts:93–108  ·  view source on GitHub ↗
(namedBlock: string)

Source from the content-addressed store, hash-verified

91}
92
93function parseNames(namedBlock: string): Set<string> {
94 const withoutComments = stripComments(namedBlock)
95 const names = withoutComments
96 .split(',')
97 .map((part) => part.trim())
98 .filter(Boolean)
99 .map((part) =>
100 part
101 .replace(/^type\s+/, '')
102 .split(/\s+as\s+/)[0]
103 ?.trim(),
104 )
105 .filter((name): name is string => Boolean(name))
106
107 return new Set(names)
108}
109
110function stripComments(source: string) {
111 return source.replace(/\/\*[\s\S]*?\*\/|\/\/.*$/gm, '')

Callers 2

importUsesFunction · 0.85
exportUsesForNamesFunction · 0.85

Calls 2

stripCommentsFunction · 0.70
replaceMethod · 0.65

Tested by

no test coverage detected