UNPKG

@dcrackel/meyersquaredui

Version:

This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.

30 lines (26 loc) 815 B
export const ROUND_ORDER = [ "Table of 256", "Table of 128", "Table of 64", "Table of 32", "Table of 16", "Table of 8", "Quarterfinal", // legacy data sometimes has this "Semifinal", "Semifinals", // legacy variant "Final", "Third Place", ]; export function roundIndex(roundLabel) { const idx = ROUND_ORDER.indexOf(roundLabel); return idx === -1 ? 999 : idx; } export function sortRoundLabels(labels) { return [...labels].sort((a, b) => roundIndex(a) - roundIndex(b)); } export function normalizeRoundNumber(roundName, bracketSize) { const startIdx = roundIndex(bracketSize); const curIdx = roundIndex(roundName); if (startIdx === 999 || curIdx === 999) return 0; return Math.max(0, curIdx - startIdx); }