dce-reactkit 3.7.34 → 3.7.36

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/dist/cjs/index.js CHANGED
@@ -15764,6 +15764,39 @@ const someAsync = (array, operatorFunction) => __awaiter(void 0, void 0, void 0,
15764
15764
  return false;
15765
15765
  });
15766
15766
 
15767
+ /**
15768
+ * Capitalize every word in a string (just the first letter)
15769
+ * @param str string to capitalize
15770
+ * @returns string with every word capitalized
15771
+ */
15772
+ const capitalize = (str) => {
15773
+ return (str
15774
+ // Split into words
15775
+ .split(' ')
15776
+ // Capitalize first letter of each word
15777
+ .map((word) => {
15778
+ return word.charAt(0).toUpperCase() + word.substring(1);
15779
+ })
15780
+ // Join back together
15781
+ .join(' '));
15782
+ };
15783
+
15784
+ /**
15785
+ * Shuffle a given array
15786
+ * @author Austen Money
15787
+ * @param arr the array to shuffle
15788
+ * @returns the shuffled array
15789
+ */
15790
+ const shuffleArray = (arr) => {
15791
+ const newArr = [...arr];
15792
+ // Shuffle using Durstenfeld algorithm
15793
+ for (let i = arr.length - 1; i > 0; i--) {
15794
+ const j = Math.floor(Math.random() * (i + 1));
15795
+ [newArr[i], newArr[j]] = [newArr[j], newArr[i]];
15796
+ }
15797
+ return newArr;
15798
+ };
15799
+
15767
15800
  /**
15768
15801
  * Days of the week
15769
15802
  * @author Gabe Abrams
@@ -15826,6 +15859,7 @@ exports.addFatalErrorHandler = addFatalErrorHandler;
15826
15859
  exports.alert = alert;
15827
15860
  exports.avg = avg;
15828
15861
  exports.canReviewLogs = canReviewLogs;
15862
+ exports.capitalize = capitalize;
15829
15863
  exports.ceilToNumDecimals = ceilToNumDecimals;
15830
15864
  exports.combineClassNames = combineClassNames;
15831
15865
  exports.compareArraysByProp = compareArraysByProp;
@@ -15864,6 +15898,7 @@ exports.prefixWithAOrAn = prefixWithAOrAn;
15864
15898
  exports.roundToNumDecimals = roundToNumDecimals;
15865
15899
  exports.setClientEventMetadataPopulator = setClientEventMetadataPopulator;
15866
15900
  exports.showFatalError = showFatalError;
15901
+ exports.shuffleArray = shuffleArray;
15867
15902
  exports.someAsync = someAsync;
15868
15903
  exports.startMinWait = startMinWait;
15869
15904
  exports.stringsToHumanReadableList = stringsToHumanReadableList;