From f7b774321b055bd02f316115317549e92af3ef5e Mon Sep 17 00:00:00 2001 From: James Lyne Date: Fri, 4 Feb 2022 20:36:10 +0000 Subject: [PATCH] Use template strings over array joins for map names --- src/store/mutations.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/store/mutations.ts b/src/store/mutations.ts index c606649..4d53a75 100644 --- a/src/store/mutations.ts +++ b/src/store/mutations.ts @@ -169,7 +169,7 @@ export const mutations: MutationTree & Mutations = { worlds.forEach(world => { state.worlds.set(world.name, world); - world.maps.forEach(map => state.maps.set([world.name, map.name].join('_'), map)); + world.maps.forEach(map => state.maps.set(`${world.name}_${map.name}`, map)); }); //Update current world if a world with the same name still exists, otherwise clear @@ -180,8 +180,8 @@ export const mutations: MutationTree & Mutations = { } //Update current map if a map with the same name still exists, otherwise clear - if(state.currentWorld && state.currentMap && state.maps.has([state.currentWorld.name, state.currentMap.name].join('_'))) { - state.currentMap = state.maps.get([state.currentWorld.name, state.currentMap.name].join('_')); + if(state.currentWorld && state.currentMap && state.maps.has(`${state.currentWorld.name}_${state.currentMap.name}`)) { + state.currentMap = state.maps.get(`${state.currentWorld.name}_${state.currentMap.name}`); } else { state.currentMap = undefined; } @@ -388,7 +388,7 @@ export const mutations: MutationTree & Mutations = { //Sets the currently active map/world [MutationTypes.SET_CURRENT_MAP](state: State, {worldName, mapName}) { - mapName = [worldName, mapName].join('_'); + mapName = `${worldName}_${mapName}`; if(!state.worlds.has(worldName)) { throw new RangeError(`Unknown world ${worldName}`);