sendou.ink/app/modules/map-list-generator/modes.ts
2022-10-09 10:55:11 +03:00

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"]);
}