sf-i-events 1.0.733 → 1.0.734

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.
package/src/util.ts CHANGED
@@ -427,8 +427,19 @@ function arrayToObject (csvArray:any) {
427
427
  })
428
428
  }
429
429
 
430
+ function titleCase(str: string) {
431
+ var splitStr = str.toLowerCase().split(' ');
432
+ for (var i = 0; i < splitStr.length; i++) {
433
+ // You do not need to check if i is larger than splitStr length, as your for does that for you
434
+ // Assign it back to the array
435
+ splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].substring(1);
436
+ }
437
+ // Directly return the joined string
438
+ return splitStr.join(' ');
439
+ }
440
+
430
441
  const exportFunctions = {
431
- callApiPresignedDelete, callApiPresignedGet, callApiPresigned, jsonObjectToHtml, clearListeners, isInteger, callApi, validateName, readCookie, timeSince, createDiagonalPattern1, createDiagonalPattern2, createDiagonalPattern3, getRandomColor, convertToCSV, parseCsv
442
+ callApiPresignedDelete, callApiPresignedGet, callApiPresigned, jsonObjectToHtml, clearListeners, isInteger, callApi, validateName, readCookie, timeSince, createDiagonalPattern1, createDiagonalPattern2, createDiagonalPattern3, getRandomColor, convertToCSV, parseCsv, titleCase
432
443
  };
433
444
 
434
445
  export default exportFunctions;
package/util.d.ts CHANGED
@@ -12,6 +12,7 @@ declare function clearListeners(old_element: HTMLElement): Node;
12
12
  declare function jsonObjectToHtml(json: any): string;
13
13
  declare function convertToCSV(arr: any[]): string;
14
14
  declare function parseCsv(csv: string): any;
15
+ declare function titleCase(str: string): string;
15
16
  declare const exportFunctions: {
16
17
  callApiPresignedDelete: typeof callApiPresignedDelete;
17
18
  callApiPresignedGet: typeof callApiPresignedGet;
@@ -29,6 +30,7 @@ declare const exportFunctions: {
29
30
  getRandomColor: typeof getRandomColor;
30
31
  convertToCSV: typeof convertToCSV;
31
32
  parseCsv: typeof parseCsv;
33
+ titleCase: typeof titleCase;
32
34
  };
33
35
  export default exportFunctions;
34
36
  //# sourceMappingURL=util.d.ts.map
package/util.js CHANGED
@@ -356,8 +356,18 @@ function arrayToObject(csvArray) {
356
356
  return headers.reduce((acc, currentHeader, i) => ((currentHeader.indexOf('cols_') >= 0 || currentHeader == '') ? acc : ((row[i] != '' && row[i] != null) ? { ...acc, ...{ [currentHeader]: JSON.parse(row[i] == "TRUE" ? "true" : row[i]) } } : acc)), {});
357
357
  });
358
358
  }
359
+ function titleCase(str) {
360
+ var splitStr = str.toLowerCase().split(' ');
361
+ for (var i = 0; i < splitStr.length; i++) {
362
+ // You do not need to check if i is larger than splitStr length, as your for does that for you
363
+ // Assign it back to the array
364
+ splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].substring(1);
365
+ }
366
+ // Directly return the joined string
367
+ return splitStr.join(' ');
368
+ }
359
369
  const exportFunctions = {
360
- callApiPresignedDelete, callApiPresignedGet, callApiPresigned, jsonObjectToHtml, clearListeners, isInteger, callApi, validateName, readCookie, timeSince, createDiagonalPattern1, createDiagonalPattern2, createDiagonalPattern3, getRandomColor, convertToCSV, parseCsv
370
+ callApiPresignedDelete, callApiPresignedGet, callApiPresigned, jsonObjectToHtml, clearListeners, isInteger, callApi, validateName, readCookie, timeSince, createDiagonalPattern1, createDiagonalPattern2, createDiagonalPattern3, getRandomColor, convertToCSV, parseCsv, titleCase
361
371
  };
362
372
  export default exportFunctions;
363
373
  //# sourceMappingURL=util.js.map