From 764cd8344df2dc9b2c271d868ae193b98b829af7 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 24 Dec 2019 20:13:47 +0100 Subject: Fix lint issues --- src/renderer/runtime/util.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'src/renderer/runtime/util.ts') diff --git a/src/renderer/runtime/util.ts b/src/renderer/runtime/util.ts index 5ea0c88..b4cd219 100644 --- a/src/renderer/runtime/util.ts +++ b/src/renderer/runtime/util.ts @@ -1,8 +1,7 @@ export function recordToMap(r: Record): Map { const ret = new Map(); - for (const k of Object.keys(r)) - ret.set(k, r[k]); + for (const k of Object.keys(r)) ret.set(k, r[k]); return ret; } @@ -10,8 +9,7 @@ export function recordToMap(r: Record): Map { export function mapValues(f: (v: V1) => V2, map: Map): Map { const ret: Map = new Map(); - for (const [k, v] of map) - ret.set(k, f(v)); + for (const [k, v] of map) ret.set(k, f(v)); return ret; } @@ -19,8 +17,7 @@ export function mapValues(f: (v: V1) => V2, map: Map): Map(f: (v: V1) => Promise, map: Map): Promise> { const ret: Map = new Map(); - for (const [k, v] of mapValues(f, map)) - ret.set(k, await v); + for (const [k, v] of mapValues(f, map)) ret.set(k, await v); return ret; } @@ -28,12 +25,12 @@ export async function mapValuesAsync(f: (v: V1) => Promise, map: export function nextPowerOf2(n: number): number { let i = 1; - while (i < n) - i *= 2; + while (i < n) i *= 2; return i; } +// eslint-disable-next-line @typescript-eslint/no-explicit-any export class Listenable { private readonly listeners: Array<(...args: T) => void> = []; @@ -46,10 +43,9 @@ export class Listenable { } } -export async function getJSON(url: string): Promise { +export async function getJSON(url: string): Promise { const res = await window.fetch(url); - if (res.status < 200 || res.status >= 300) - throw new Error(res.statusText); + if (res.status < 200 || res.status >= 300) throw new Error(res.statusText); return await res.json(); } -- cgit v1.2.3