@contextvm/ctxcn
Version:
A command-line utility inspired by shadcn that streamlines the integration of ContextVM (CVM) servers into your TypeScript projects
17 lines • 671 B
JavaScript
/**
* Convert a string to PascalCase
* Handles various separators: spaces, hyphens, underscores, and forward slashes
*/
export const toPascalCase = (s) => {
if (!s || typeof s !== "string") {
return "";
}
// Replace forward slashes with hyphens to handle names like 'example-servers/everything'
const normalized = s.replace(/\//g, "-");
// Convert to camelCase first, then capitalize the first letter
const camelCased = normalized
.toLowerCase()
.replace(/([-_ ]\w)/g, (g) => (g ? g.charAt(1).toUpperCase() : ""));
return camelCased.charAt(0).toUpperCase() + camelCased.slice(1);
};
//# sourceMappingURL=utils.js.map