|
Last change
on this file since ba17441 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
384 bytes
|
| Line | |
|---|
| 1 | import { words } from './words.mjs';
|
|---|
| 2 |
|
|---|
| 3 | function startCase(str) {
|
|---|
| 4 | const words$1 = words(str.trim());
|
|---|
| 5 | let result = '';
|
|---|
| 6 | for (let i = 0; i < words$1.length; i++) {
|
|---|
| 7 | const word = words$1[i];
|
|---|
| 8 | if (result) {
|
|---|
| 9 | result += ' ';
|
|---|
| 10 | }
|
|---|
| 11 | result += word[0].toUpperCase() + word.slice(1).toLowerCase();
|
|---|
| 12 | }
|
|---|
| 13 | return result;
|
|---|
| 14 | }
|
|---|
| 15 |
|
|---|
| 16 | export { startCase };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.