source: node_modules/es-toolkit/dist/compat/string/startCase.js@ a762898

Last change on this file since a762898 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 768 bytes
Line 
1'use strict';
2
3Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
5const deburr = require('./deburr.js');
6const words = require('../../string/words.js');
7const normalizeForCase = require('../_internal/normalizeForCase.js');
8
9function startCase(str) {
10 const words$1 = words.words(normalizeForCase.normalizeForCase(deburr.deburr(str)).trim());
11 let result = '';
12 for (let i = 0; i < words$1.length; i++) {
13 const word = words$1[i];
14 if (result) {
15 result += ' ';
16 }
17 if (word === word.toUpperCase()) {
18 result += word;
19 }
20 else {
21 result += word[0].toUpperCase() + word.slice(1).toLowerCase();
22 }
23 }
24 return result;
25}
26
27exports.startCase = startCase;
Note: See TracBrowser for help on using the repository browser.