MCPcopy Create free account
hub / github.com/bernaferrari/FigmaToCode / stringToClassName

Function stringToClassName

packages/backend/src/common/numToAutoFixed.ts:90–102  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

88 str.replace(new RegExp(escapeRegExp(find), "g"), replace);
89
90export function stringToClassName(name: string): string {
91 const words = name.split(/[^a-zA-Z0-9]+/);
92 const camelCaseWords = words.map((word, index) => {
93 if (index === 0) {
94 const cleanedWord = word.replace(/^[^a-zA-Z]+/g, "");
95 return (
96 cleanedWord.charAt(0).toUpperCase() + cleanedWord.slice(1).toLowerCase()
97 );
98 }
99 return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
100 });
101 return camelCaseWords.join("");
102}

Callers 5

flutterMainFunction · 0.90
buildMethod · 0.90
buildMethod · 0.90
swiftuiMainFunction · 0.90
composeMainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected