dce-reactkit 3.7.35 → 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 +17 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/helpers/shuffleArray.d.ts +8 -0
- package/dist/cjs/types/index.d.ts +2 -1
- package/dist/esm/index.js +17 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/helpers/shuffleArray.d.ts +8 -0
- package/dist/esm/types/index.d.ts +2 -1
- package/dist/index.d.ts +9 -1
- package/package.json +1 -1
- package/src/helpers/shuffleArray.ts +19 -0
- package/src/index.ts +2 -0
package/dist/cjs/index.js
CHANGED
|
@@ -15781,6 +15781,22 @@ const capitalize = (str) => {
|
|
|
15781
15781
|
.join(' '));
|
|
15782
15782
|
};
|
|
15783
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
|
+
|
|
15784
15800
|
/**
|
|
15785
15801
|
* Days of the week
|
|
15786
15802
|
* @author Gabe Abrams
|
|
@@ -15882,6 +15898,7 @@ exports.prefixWithAOrAn = prefixWithAOrAn;
|
|
|
15882
15898
|
exports.roundToNumDecimals = roundToNumDecimals;
|
|
15883
15899
|
exports.setClientEventMetadataPopulator = setClientEventMetadataPopulator;
|
|
15884
15900
|
exports.showFatalError = showFatalError;
|
|
15901
|
+
exports.shuffleArray = shuffleArray;
|
|
15885
15902
|
exports.someAsync = someAsync;
|
|
15886
15903
|
exports.startMinWait = startMinWait;
|
|
15887
15904
|
exports.stringsToHumanReadableList = stringsToHumanReadableList;
|