Skip to content

Commit

Permalink
1) Add reverse method so we don't make an inline change to a computed
Browse files Browse the repository at this point in the history
   property.
  • Loading branch information
RobSpectre committed Jan 19, 2023
1 parent f465fe0 commit ba44a9b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/components/SnackTrack/SnackTrackRound.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export default {
const players = []
if (this.playerOrder === 'lowestScoreFirst') {
const reversedPlayers = this.getPlayersByScore.revese()
const reversedPlayers = this.reverse(this.getPlayersByScore)
reversedPlayers.forEach((player) => {
players.push({
Expand Down Expand Up @@ -198,6 +198,15 @@ export default {
this.nextPlayer()
}
},
reverse (array) {
const output = []
while (array.length) {
output.push(array.pop())
}
return output
},
...mapActions(useGameStore,
['increasePlayerButton',
'increasePlayerIndex',
Expand Down

0 comments on commit ba44a9b

Please sign in to comment.