dce-reactkit 3.7.35 → 3.7.37

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
@@ -789,12 +789,21 @@ const visitServerEndpoint = (opts) => __awaiter(void 0, void 0, void 0, function
789
789
  // Error
790
790
  throw new ErrorWithCode(stubResponse.errorMessage, stubResponse.errorCode);
791
791
  }
792
+ // Remove properties with undefined values
793
+ let params;
794
+ if (opts.params) {
795
+ params = Object.fromEntries(Object
796
+ .entries(opts.params)
797
+ .filter(([key, value]) => {
798
+ return value !== undefined;
799
+ }));
800
+ }
792
801
  // Send the request
793
802
  const sendRequest = yield getSendRequest();
794
803
  const response = yield sendRequest({
795
804
  path: opts.path,
796
805
  method: (_c = opts.method) !== null && _c !== void 0 ? _c : 'GET',
797
- params: opts.params,
806
+ params,
798
807
  });
799
808
  // Check for failure
800
809
  if (!response || !response.body) {
@@ -15781,6 +15790,22 @@ const capitalize = (str) => {
15781
15790
  .join(' '));
15782
15791
  };
15783
15792
 
15793
+ /**
15794
+ * Shuffle a given array
15795
+ * @author Austen Money
15796
+ * @param arr the array to shuffle
15797
+ * @returns the shuffled array
15798
+ */
15799
+ const shuffleArray = (arr) => {
15800
+ const newArr = [...arr];
15801
+ // Shuffle using Durstenfeld algorithm
15802
+ for (let i = arr.length - 1; i > 0; i--) {
15803
+ const j = Math.floor(Math.random() * (i + 1));
15804
+ [newArr[i], newArr[j]] = [newArr[j], newArr[i]];
15805
+ }
15806
+ return newArr;
15807
+ };
15808
+
15784
15809
  /**
15785
15810
  * Days of the week
15786
15811
  * @author Gabe Abrams
@@ -15882,6 +15907,7 @@ exports.prefixWithAOrAn = prefixWithAOrAn;
15882
15907
  exports.roundToNumDecimals = roundToNumDecimals;
15883
15908
  exports.setClientEventMetadataPopulator = setClientEventMetadataPopulator;
15884
15909
  exports.showFatalError = showFatalError;
15910
+ exports.shuffleArray = shuffleArray;
15885
15911
  exports.someAsync = someAsync;
15886
15912
  exports.startMinWait = startMinWait;
15887
15913
  exports.stringsToHumanReadableList = stringsToHumanReadableList;