diff options
-rw-r--r-- | src/app.ts | 2 | ||||
-rw-r--r-- | src/util.ts | 4 |
2 files changed, 3 insertions, 3 deletions
@@ -29,7 +29,7 @@ window.onload = () => { xhr.onload = function() { var mapDef = new MapData(JSON.parse(this.responseText)); - var inputHandler = new InputHandler(util.numberArrayToMap(relevantKeys)); + var inputHandler = new InputHandler(util.arrayToObject(relevantKeys)); mapContext = new MapContext(mapDef, inputHandler); } diff --git a/src/util.ts b/src/util.ts index ad2b482..0761d2d 100644 --- a/src/util.ts +++ b/src/util.ts @@ -12,8 +12,8 @@ export function mapPromises<T>(promises: {[key: string]: Promise<T>}): Promise<{ return Promise.all(p).then(() => ret); } -export function numberArrayToMap(arr: number[]): {[key: number]: boolean} { - var ret: {[key: number]: boolean} = {}; +export function arrayToObject(arr: (number|string)[]): {[key: string]: boolean} { + var ret: {[key: string]: boolean} = {}; for (let v of arr) ret[v] = true; |