This commit is contained in:
Philippe Torrel
2026-07-08 11:55:05 +02:00
parent cc3dc382ed
commit 199d580016
247 changed files with 38615 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="de">
<head>
<meta charset="UTF-8" />
@@ -48,7 +48,7 @@
];
const cocktailRecipes = [honoluluFlip, casualFriday, pinkDolly];
const ingredientsFromMyBar = [
const AVAILABLE_INGREDIENTS = [
'Pineapple',
'Maracuja Juice',
'Cream',
@@ -65,19 +65,26 @@
];
const isMixableWithMyIngredients = (cocktailRecipe) => {
/* ??? */
return isMixableWith(cocktailRecipe, AVAILABLE_INGREDIENTS);
};
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));
const hasIngredient = (listAr, searchStr) => {
return listAr.includes(searchStr);
};
console.log(cocktailRecipes);
console.log('isMixable: ', isMixableWith(casualFriday, AVAILABLE_INGREDIENTS));
console.log(
cocktailRecipes.find((recipeAr) => {
return isMixableWithMyIngredients(recipeAr);
}),
);
// => [ 'Vodka', 'Lime Juice', 'Apple Juice', 'Cucumber' ]
</script>
</body>