mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-07 22:12:57 -05:00
16 lines
371 B
TypeScript
16 lines
371 B
TypeScript
import shuffle from "just-shuffle";
|
|
import type { ModeShort } from "../in-game-lists";
|
|
|
|
export function modesOrder(
|
|
type: "EQUAL" | "SZ_EVERY_OTHER",
|
|
modes: ModeShort[]
|
|
): ModeShort[] {
|
|
if (type === "EQUAL") {
|
|
return shuffle(modes);
|
|
}
|
|
|
|
const withoutSZ = shuffle(modes.filter((mode) => mode !== "SZ"));
|
|
|
|
return withoutSZ.flatMap((mode) => [mode, "SZ"]);
|
|
}
|