kupos-ui-components-lib 10.1.0 → 10.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -264,9 +264,19 @@ const commonService = {
264
264
  if (str) {
265
265
  let strArr = str.split(" ");
266
266
  for (let i = 0; i < strArr.length; i++) {
267
- strArr[i] =
268
- strArr[i][0] &&
269
- strArr[i][0].toUpperCase() + strArr[i].substr(1).toLowerCase();
267
+ let word = strArr[i];
268
+ if (word) {
269
+ let firstLetterIdx = word.search(/[a-zA-Z\u00C0-\u00FF]/);
270
+ if (firstLetterIdx !== -1) {
271
+ strArr[i] =
272
+ word.slice(0, firstLetterIdx) +
273
+ word[firstLetterIdx].toUpperCase() +
274
+ word.slice(firstLetterIdx + 1).toLowerCase();
275
+ }
276
+ else {
277
+ strArr[i] = word.toLowerCase();
278
+ }
279
+ }
270
280
  }
271
281
  return strArr.join(" ");
272
282
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kupos-ui-components-lib",
3
- "version": "10.1.0",
3
+ "version": "10.1.1",
4
4
  "description": "A reusable UI components package",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -277,9 +277,18 @@ const commonService = {
277
277
  if (str) {
278
278
  let strArr = str.split(" ");
279
279
  for (let i = 0; i < strArr.length; i++) {
280
- strArr[i] =
281
- strArr[i][0] &&
282
- strArr[i][0].toUpperCase() + strArr[i].substr(1).toLowerCase();
280
+ let word = strArr[i];
281
+ if (word) {
282
+ let firstLetterIdx = word.search(/[a-zA-Z\u00C0-\u00FF]/);
283
+ if (firstLetterIdx !== -1) {
284
+ strArr[i] =
285
+ word.slice(0, firstLetterIdx) +
286
+ word[firstLetterIdx].toUpperCase() +
287
+ word.slice(firstLetterIdx + 1).toLowerCase();
288
+ } else {
289
+ strArr[i] = word.toLowerCase();
290
+ }
291
+ }
283
292
  }
284
293
  return strArr.join(" ");
285
294
  }