Skip to content

Commit 10b68d7

Browse files
committed
Feat(data:Js): Add utility function to convert strings to camelCase
1 parent ef43cbd commit 10b68d7

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

public/data/javascript.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,20 @@
218218
"tags": ["string", "case", "snake_case"],
219219
"author": "axorax"
220220
},
221+
{
222+
"title": "Convert String to Camel Case",
223+
"description": "Converts a given string into camelCase.",
224+
"code": [
225+
"function toCamelCase(str) {",
226+
" return str.replace(/\\W+(.)/g, (match, chr) => chr.toUpperCase());",
227+
"}",
228+
"",
229+
"// Example usage:",
230+
"console.log(toCamelCase('hello world test')); // Output: 'helloWorldTest'"
231+
],
232+
"tags": ["string", "case", "camelCase"],
233+
"author": "aumirza"
234+
},
221235
{
222236
"title": "Remove Vowels from a String",
223237
"description": "Removes all vowels from a given string.",

0 commit comments

Comments
 (0)