diff options
Diffstat (limited to 'src/util.ts')
-rw-r--r-- | src/util.ts | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/util.ts b/src/util.ts index 73788ad..453966e 100644 --- a/src/util.ts +++ b/src/util.ts @@ -1,25 +1,25 @@ export function mapFromObject<T>(obj: {[key: string]: T}): Map<string, T> { - let ret = new Map(); + const ret = new Map(); - for (let k of Object.keys(obj)) + for (const k of Object.keys(obj)) ret.set(k, obj[k]); return ret; } export function mapValues<K, V1, V2>(f: (v: V1) => V2, map: Map<K, V1>): Map<K, V2> { - let ret: Map<K, V2> = new Map(); + const ret: Map<K, V2> = new Map(); - for (let [k, v] of map) + for (const [k, v] of map) ret.set(k, f(v)); return ret; } export async function mapValuesAsync<K, V1, V2>(f: (v: V1) => Promise<V2>, map: Map<K, V1>): Promise<Map<K, V2>> { - let ret: Map<K, V2> = new Map(); + const ret: Map<K, V2> = new Map(); - for (let [k, v] of mapValues(f, map)) + for (const [k, v] of mapValues(f, map)) ret.set(k, await v); return ret; |