@tmlmt/cooklang-parser / Ingredient
Interface: Ingredient
Represents an ingredient in a recipe.
Properties
alternatives?
optionalalternatives:Set<number>
The list of indexes of the ingredients mentioned in the preparation as alternatives to this ingredient
extras?
optionalextras:IngredientExtras
The collection of potential additional metadata for the ingredient
flags?
optionalflags:IngredientFlag[]
A list of potential state modifiers or other flags for the ingredient
name
name:
string
The name of the ingredient.
preparation?
optionalpreparation:string
The preparation of the ingredient.
quantities?
optionalquantities: (IngredientQuantityGroup|IngredientQuantityAndGroup)[]
Represents the quantities list for an ingredient as groups. Each group contains summed quantities that share the same alternative signature. Groups can be either simple (single unit) or AND groups (incompatible primary units with summed equivalents). Only populated for primary ingredients (not alternative-only). Quantities without alternatives are merged opportunistically when units are compatible. Quantities with alternatives are only merged if the alternatives are exactly the same.
usedAsPrimary?
optionalusedAsPrimary:boolean
True if this ingredient appears as the primary choice (first in an alternatives list). Only primary ingredients have quantities populated directly.
Alternative-only ingredients (usedAsPrimary undefined/false) have their quantities available via the Recipe.choices structure.