use optional chaining in age ratings getter

This commit is contained in:
Gamebrary 2022-05-18 22:01:55 -07:00
parent 4148e45487
commit 8f1d9cc20b

View file

@ -59,11 +59,9 @@ export default {
},
gameAgeRatings: () => (game) => {
const ageRatings = game && game.age_ratings;
if (!game?.age_ratings) return null;
if (!ageRatings) return null;
return ageRatings.map(({ category, rating }) => {
return game?.age_ratings.map(({ category, rating }) => {
const { name, ratings } = AGE_RATING_SYSTEMS.find(({ id }) => id === category);
return { name, rating: ratings[rating] };