refactor(api, curriculum): use the shared shuffleArray util (#56444)

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
Huyen Nguyen
2024-10-02 06:55:38 -07:00
committed by GitHub
parent 52ea949997
commit 0ba9eeff43
4 changed files with 8 additions and 42 deletions

View File

@@ -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);