mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-03-28 23:01:57 -04:00
refactor(api, curriculum): use the shared shuffleArray util (#56444)
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
@@ -1,18 +1,4 @@
|
||||
function shuffleArray(arr) {
|
||||
let currentIndex = arr.length,
|
||||
randomIndex;
|
||||
|
||||
while (currentIndex != 0) {
|
||||
randomIndex = Math.floor(Math.random() * currentIndex);
|
||||
currentIndex--;
|
||||
[arr[currentIndex], arr[randomIndex]] = [
|
||||
arr[randomIndex],
|
||||
arr[currentIndex]
|
||||
];
|
||||
}
|
||||
|
||||
return arr;
|
||||
}
|
||||
import { shuffleArray } from '../../../../shared/utils/shuffle-array';
|
||||
|
||||
function filterDeprecated(arr) {
|
||||
return arr.filter(i => !i.deprecated);
|
||||
|
||||
Reference in New Issue
Block a user