diff --git a/src/favicon.ts b/src/favicon.ts index 5141bf1f37..a8391b1adc 100644 --- a/src/favicon.ts +++ b/src/favicon.ts @@ -101,7 +101,7 @@ export default class Favicon { h: number; } { const opt = { - n: typeof n === "number" ? Math.abs(n as number | 0) : n, + n: typeof n === "number" ? Math.abs(n | 0) : n, len: ("" + n).length, // badge positioning constants as percentages x: 0.4, @@ -178,7 +178,7 @@ export default class Favicon { this.context.fillStyle = params.textColor; if (typeof opt.n === "number" && opt.n > 999) { - const count = (opt.n > 9999 ? 9 : Math.floor((opt.n as number) / 1000)) + "k+"; + const count = (opt.n > 9999 ? 9 : Math.floor(opt.n / 1000)) + "k+"; this.context.fillText(count, Math.floor(opt.x + opt.w / 2), Math.floor(opt.y + opt.h - opt.h * 0.2)); } else { this.context.fillText("" + opt.n, Math.floor(opt.x + opt.w / 2), Math.floor(opt.y + opt.h - opt.h * 0.15)); diff --git a/src/vector/getconfig.ts b/src/vector/getconfig.ts index 39a4ff6850..5078560b17 100644 --- a/src/vector/getconfig.ts +++ b/src/vector/getconfig.ts @@ -23,7 +23,7 @@ export async function getVectorConfig(relativeLocation = ""): Promise { - if (key.indexOf("loglevel:") === 0) { + if (key.startsWith("loglevel:")) { window.localStorage.removeItem(key); } }); diff --git a/src/vector/mobile_guide/index.ts b/src/vector/mobile_guide/index.ts index 91e10181f1..30bef430c8 100644 --- a/src/vector/mobile_guide/index.ts +++ b/src/vector/mobile_guide/index.ts @@ -70,7 +70,7 @@ async function initPage(): Promise { try { const result = await fetch(`https://${serverName}/.well-known/matrix/client`); const wkConfig = await result.json(); - if (wkConfig && wkConfig["m.homeserver"]) { + if (wkConfig?.["m.homeserver"]) { hsUrl = wkConfig["m.homeserver"]["base_url"]; if (wkConfig["m.identity_server"]) { @@ -78,7 +78,7 @@ async function initPage(): Promise { } } } catch (e) { - if (wkConfig && wkConfig["m.homeserver"]) { + if (wkConfig?.["m.homeserver"]) { hsUrl = wkConfig["m.homeserver"]["base_url"] || undefined; if (wkConfig["m.identity_server"]) {