![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
@js-util/array-shuffle
Advanced tools
Given an array, shuffles a cloned copy, and returns it. (Fisher–Yates method)
Given an array, shuffles a cloned copy, and returns it. (Fisher–Yates method)
This does not aim for true perfect randomness. Just to be good enough and fast
npm install --save @js-util/array-shuffle
// Importing the module
const arrayShuffle = require("@js-util/array-shuffle");
// Example array to shuffle
const array = [1,2,3,4];
// Shuffle the array
let shuffled = arrayShuffle( array );
/**
* Given an array, shuffle its content randomly.
* Note that the original array is not affected
*
* This does the : Fisher–Yates shuffle underneath the hood
* https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm
*
* This does not aim for true perfect randomness. Just to be good enough and fast
*
* @param {Array<*>} array
*
* @return {Array<*>} shuffled array
*/
function arrayShuffle(array) {
// Clone the array
array = arrays.slice(0);
// Shuffle it
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
//
// Note that the below code is equivalent to
//
// ```
// var temp = array[i];
// array[i] = array[j];
// array[j] = temp;
// ```
//
[array[i], array[j]] = [array[j], array[i]];
}
// Return the shuffled array
return array;
}
// Export the function
module.exports = arrayShuffle;
FAQs
Given an array, shuffles a cloned copy, and returns it. (Fisher–Yates method)
The npm package @js-util/array-shuffle receives a total of 3 weekly downloads. As such, @js-util/array-shuffle popularity was classified as not popular.
We found that @js-util/array-shuffle demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.