This commit is contained in:
Philippe Torrel
2026-09-28 09:42:41 +02:00
parent 8a2d979830
commit 80296c10d0
6 changed files with 89 additions and 16 deletions
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="de">
<head>
<meta charset="UTF-8" />
@@ -64,19 +64,19 @@
'Cucumber',
];
const isMixableWithMyIngredients = (cocktailRecipe) => {
/* ??? */
const isMixableWithMyIngredients = (cocktailRecipe, allIngredients = ingredientsFromMyBar) => {
return isMixableWith(cocktailRecipe, allIngredients);
};
const isMixableWith = (cocktailRecipe, availableIngredients) => {
return cocktailRecipe.every((ingredientFromRecipe) =>
hasIngredient(availableIngredients, ingredientFromRecipe)
hasIngredient(availableIngredients, ingredientFromRecipe),
);
};
const hasIngredient = (listOfIngredients, searchedIngredient) => listOfIngredients.includes(searchedIngredient);
// console.log(cocktailRecipes./* ??? */(isMixableWithMyIngredients));
console.log(cocktailRecipes.find((cocktailRecipe) => isMixableWithMyIngredients(cocktailRecipe)));
// => [ 'Vodka', 'Lime Juice', 'Apple Juice', 'Cucumber' ]
</script>