Skip to main content
Glama
extractDictionaryKey.ts545 B
import { basename, dirname, extname } from 'node:path'; import { detectExportedComponentName } from '../writeContentDeclaration/detectExportedComponentName'; export const extractDictionaryKey = ( filePath: string, fileText: string ): string => { const componentName = detectExportedComponentName(fileText); if (componentName) { return componentName; } const ext = extname(filePath); let baseName = basename(filePath, ext); if (baseName === 'index') { baseName = basename(dirname(filePath)); } return baseName; };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aymericzip/intlayer'

If you have feedback or need assistance with the MCP directory API, please join our Discord server