Skip to content

Commit c6e3526

Browse files
committed
clean up and document, #158
1 parent fa57b4f commit c6e3526

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/components/PlayerInfo.vue

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,17 @@ export default {
6868
}
6969
},
7070
methods: {
71+
/**
72+
* Arranges raw player data from the game server into an object
73+
* that is easier to query in order to display a player's data, e.g.:
74+
* Health: 25 / 30
75+
* instead of
76+
* Health: 25
77+
* Max health: 30
78+
*
79+
* @param {Object} playerData Raw player data from the server
80+
* @return {Object} Data organized by health, mana, and scrap, including current and max values
81+
*/
7182
arrangePlayerData(playerData) {
7283
const rawData = playerData;
7384
const arrangedData = {
@@ -76,7 +87,6 @@ export default {
7687
scrap: {}
7788
};
7889
for (let key in rawData) {
79-
console.log(key + "=" + rawData[key]);
8090
if (key === "HEALTH") {
8191
arrangedData.health["current"] = rawData[key];
8292
}
@@ -93,7 +103,6 @@ export default {
93103
arrangedData.scrap["current"] = rawData[key];
94104
}
95105
}
96-
console.log(arrangedData);
97106
return arrangedData;
98107
}
99108
}

0 commit comments

Comments
 (0)