MCPcopy Index your code
hub / github.com/codeaashu/claude-code / getFileExtensionForAnalytics

Function getFileExtensionForAnalytics

src/services/analytics/metadata.ts:323–337  ·  view source on GitHub ↗
(
  filePath: string,
)

Source from the content-addressed store, hash-verified

321 * @returns The sanitized extension, 'other' for long extensions, or undefined if no extension
322 */
323export function getFileExtensionForAnalytics(
324 filePath: string,
325): AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS | undefined {
326 const ext = extname(filePath).toLowerCase()
327 if (!ext || ext === '.') {
328 return undefined
329 }
330
331 const extension = ext.slice(1) // remove leading dot
332 if (extension.length > MAX_FILE_EXTENSION_LENGTH) {
333 return 'other' as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS
334 }
335
336 return extension as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS
337}
338
339/** Allow list of commands we extract file extensions from. */
340const FILE_COMMANDS = new Set([

Callers 4

callFunction · 0.85
callInnerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected