From 15e6c50641e7a60723c53ef526be59184d1b3bc0 Mon Sep 17 00:00:00 2001 From: Rhiannon Morris Date: Wed, 1 Jan 2025 00:41:07 +0100 Subject: [PATCH] =?UTF-8?q?let=20=E2=86=92=20const?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/run.ts | 4 ++-- script/shuffle.ts | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/script/run.ts b/script/run.ts index 3a0f836..b8c0d0b 100644 --- a/script/run.ts +++ b/script/run.ts @@ -183,7 +183,7 @@ export function applyConfiguration(): void { } export function move(c: Conf, ...ms: Rotation[]): Conf { - let res: Partial = {}; + const res: Partial = {}; for (const pane of allPanes) { res[pane] = applyMoves(c[pane], ms) } return res as Conf; } @@ -290,7 +290,7 @@ export function fadeTo(newPane: Pane): void { -let reducedMotion = +const reducedMotion = matchMedia(`(prefers-reduced-motion: reduce), (max-height: 649px), (max-width: 649px)`); diff --git a/script/shuffle.ts b/script/shuffle.ts index 1ec208f..7df95a7 100644 --- a/script/shuffle.ts +++ b/script/shuffle.ts @@ -1,5 +1,5 @@ function shuffle(subject: A[]): A[] { - let res = Array.from(subject); + const res = Array.from(subject); for (let i = 0; i < res.length - 1; ++i) { const j = i + Math.floor(Math.random() * (res.length - i)); @@ -16,16 +16,16 @@ function shuffle(subject: A[]): A[] { function group(subject: A[], keepTogether: A[][]): A[][] { type Value = {array: A[], added: boolean}; - let groups: Map = new Map; + const groups: Map = new Map; for (const xs of keepTogether) { - let value = {array: xs, added: false}; + const value = {array: xs, added: false}; for (const x of xs) { groups.set(x, value); } } - let res = []; + const res = []; for (const x of subject) { - let group = groups.get(x); + const group = groups.get(x); if (group?.added) { continue; } else if (group) { group.added = true; @@ -43,10 +43,10 @@ function groupedShuffle(subject: A[], keepTogether: A[][]): A[] { } function shuffleAll() { - let groups = [group('myno', 'abyss'), group('clip', 'cervine')]; + const groups = [group('myno', 'abyss'), group('clip', 'cervine')]; for (const elem of Array.from(document.getElementsByClassName('shuffle'))) { - let shuffled = groupedShuffle(Array.from(elem.children), groups); + const shuffled = groupedShuffle(Array.from(elem.children), groups); elem.innerHTML = ''; for (const child of shuffled) { @@ -55,7 +55,7 @@ function shuffleAll() { } function group(...xs: string[]) { - let elements = xs.map(x => document.getElementById(x)); + const elements = xs.map(x => document.getElementById(x)); return elements.every(x => x) ? elements as HTMLElement[] : []; } }