let → const

This commit is contained in:
Rhiannon Morris 2025-01-01 00:41:07 +01:00
parent a4f3877b78
commit 15e6c50641
2 changed files with 10 additions and 10 deletions

View file

@ -183,7 +183,7 @@ export function applyConfiguration(): void {
}
export function move(c: Conf, ...ms: Rotation[]): Conf {
let res: Partial<Conf> = {};
const res: Partial<Conf> = {};
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)`);

View file

@ -1,5 +1,5 @@
function shuffle<A>(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<A>(subject: A[]): A[] {
function group<A>(subject: A[], keepTogether: A[][]): A[][] {
type Value = {array: A[], added: boolean};
let groups: Map<A, Value> = new Map;
const groups: Map<A, Value> = 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<A>(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[] : [];
}
}