Preparing search index...

    Function computeShoppingList

    • Computes a flat shopping list from the current menu, recipes and purchase state.

      Iterates over non-cooked menu items, looks up each recipe and accumulates ingredient quantities (multiplied by the menu item count). Duplicate ingredient names across recipes are merged into a single entry. Quantities are parsed to numbers via parseQuantity, summed numerically and formatted once at the end (rounded to six decimals to avoid binary floating point artifacts). Ingredients that never carry a quantity keep an empty string rather than "0".

      Parameters

      • menu: menuTableElement[]

        All current menu items (cooked items are excluded)

      • recipes: recipeTableElement[]

        Full recipe catalogue used to resolve menu[].recipeId

      • purchasedIngredients: Map<string, boolean>

        Map of ingredient name → purchased state

      Returns ComputedShoppingItem[]

      Flat array of aggregated shopping items, one per unique ingredient name