Merge pull request #1573 from danielyxie/dev

fix bug in corp
This commit is contained in:
hydroflame 2021-10-26 17:45:41 -04:00 committed by GitHub
commit f3d162e5cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -8,11 +8,12 @@ import { Cities } from "./Cities";
import { IMap } from "../types"; import { IMap } from "../types";
export function createCityMap<T>(initValue: T): IMap<T> { export function createCityMap<T>(initValue: T): IMap<T> {
const map: IMap<any> = {}; const map: IMap<T> = {};
const cities = Object.keys(Cities); const cities = Object.keys(Cities);
for (let i = 0; i < cities.length; ++i) { for (let i = 0; i < cities.length; ++i) {
map[cities[i]] = initValue; map[cities[i]] = initValue;
} }
return map; // round try JSON so to make sure none of the initial values have the same references.
return JSON.parse(JSON.stringify(map));
} }