@tmlmt/cooklang-parser / isSimpleGroup
Function: isSimpleGroup()
isSimpleGroup(
entry):entry is IngredientQuantityGroup
Type guard to check if an ingredient quantity entry is a simple group.
Simple groups have a single quantity with optional unit and equivalents.
Parameters
entry
The quantity entry to check
IngredientQuantityGroup | IngredientQuantityAndGroup
Returns
entry is IngredientQuantityGroup
true if this is a simple group (has quantity property)
Example
typescript
for (const entry of ingredient.quantities) {
if (isSimpleGroup(entry)) {
// entry.quantity is available
// entry.unit is available
}
}