Skip to content

Commit

Permalink
Improve solution for getTrainerPokemons
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinoptland committed May 28, 2019
1 parent cb4de24 commit 457a425
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions 3.data-mining.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ const getGymLeader = (gym, trainers) => {
return trainers.find(trainer => trainer.id === gym.trainerId)
}
const getTrainerPokemons = (trainer, pokemons) => {
return trainer.pokemonIds.map(id => {
return getPokemonById(pokemons, id)
})
return pokemons.filter(pokemon => trainer.pokemonIds.includes(pokemon.id))
}

const getTrainersPokemons = (trainers, pokemons) => {
Expand Down

0 comments on commit 457a425

Please sign in to comment.