Skip to content

Commit

Permalink
replaced map with loop
Browse files Browse the repository at this point in the history
  • Loading branch information
muhammadharis4 committed Oct 15, 2023
1 parent 3decef8 commit 08067a0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib/toCamelCase.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ export default function toCamelCase(inputString) {

const words = inputString.split(/[\s\-_]+/);

Check warning on line 6 in src/lib/toCamelCase.js

View check run for this annotation

Codecov / codecov/patch

src/lib/toCamelCase.js#L6

Added line #L6 was not covered by tests

words.map((word) => word.charAt(0).toUpperCase() + word.slice(1));
for (let i = 1; i < words.length; i++) {
words[i] = words[i].substr(0, 1).toUpperCase() + words[i].substr(1);

Check warning on line 9 in src/lib/toCamelCase.js

View check run for this annotation

Codecov / codecov/patch

src/lib/toCamelCase.js#L8-L9

Added lines #L8 - L9 were not covered by tests
}

return words.join('');

Check warning on line 12 in src/lib/toCamelCase.js

View check run for this annotation

Codecov / codecov/patch

src/lib/toCamelCase.js#L12

Added line #L12 was not covered by tests
}

0 comments on commit 08067a0

Please sign in to comment.