Skip to main content
Glama
toLowerCamelCase.ts667 B
/** * Convert a string to lowerCamelCase * e.g. "MyComponent" => "myComponent" * e.g. "auth-middleware" => "authMiddleware" */ export const toLowerCamelCase = (str: string): string => { if (!str) { return ''; } // Handle kebab-case: "auth-middleware" => "authMiddleware" if (str.includes('-')) { return str .split('-') .map((word, index) => { if (index === 0) { return word.toLowerCase(); } return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase(); }) .join(''); } // Handle PascalCase: "MyComponent" => "myComponent" return str.charAt(0).toLowerCase() + str.slice(1); };

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