From 0462e70229daecedea607a275e51b6b6c4a00f07 Mon Sep 17 00:00:00 2001 From: Katja Lutz Date: Sun, 24 Jul 2022 16:47:44 +0200 Subject: [PATCH] refactor: replace own shuffle function with external froebel shuffle --- src/components/WelcomeModal.tsx | 3 +-- src/util.tsx | 12 ------------ 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/components/WelcomeModal.tsx b/src/components/WelcomeModal.tsx index a286bd1..cfc1774 100644 --- a/src/components/WelcomeModal.tsx +++ b/src/components/WelcomeModal.tsx @@ -33,9 +33,8 @@ import { getDomain, getHost, onClickFocus, - shuffle, } from "~/util"; -import { capitalize } from "froebel"; +import { capitalize, shuffle } from "froebel"; import { markdownHelpUrl } from "./Markdown"; import AgileCalculator from "./AgileCalculator"; diff --git a/src/util.tsx b/src/util.tsx index 953c686..5da82a4 100644 --- a/src/util.tsx +++ b/src/util.tsx @@ -46,18 +46,6 @@ export const resetInput = el.dispatchEvent(event); }; -// https://dev.to/codebubb/how-to-shuffle-an-array-in-javascript-2ikj -export const shuffle = (list: any[]) => { - for (let i = list.length - 1; i > 0; i--) { - const j = Math.floor(Math.random() * (i + 1)); - const temp = list[i]; - list[i] = list[j]; - list[j] = temp; - } - - return list; -}; - export const getDomain = () => import.meta.env.SSR ? process.env.DOMAIN || "localhost" : location.hostname;