Skip to content

Commit

Permalink
add fallback to empty array
Browse files Browse the repository at this point in the history
  • Loading branch information
VovaStelmashchuk committed Sep 15, 2024
1 parent 71fdfaa commit 3e151e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions features/cocktail/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const Database = require('../../database/newclient');
const { getCocktailBySlug } = require("../../database/cocktail");

async function getRecomendations(cocktail) {
const goodMatchSlugs = cocktail.matches.good;
const otherMatchSlugs = cocktail.matches.other;
const goodMatchSlugs = cocktail.matches.good || [];
const otherMatchSlugs = cocktail.matches.other || [];

const goodCocktails = await Database.collection('cocktails')
.find({ slug: { $in: Array.from(goodMatchSlugs) } })
Expand Down

0 comments on commit 3e151e8

Please sign in to comment.