mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 20:28:46 -05:00
ingredient step sorting dialog and headline option on desktop
This commit is contained in:
22
vue3/src/utils/model_utils.ts
Normal file
22
vue3/src/utils/model_utils.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import {Ingredient} from "@/openapi";
|
||||
|
||||
/**
|
||||
* returns a string representing an ingredient
|
||||
* @param ingredient
|
||||
*/
|
||||
export function ingredientToString(ingredient: Ingredient) {
|
||||
let content = []
|
||||
if(ingredient.amount != 0){
|
||||
content.push(ingredient.amount)
|
||||
}
|
||||
if(ingredient.unit){
|
||||
content.push(ingredient.unit.name)
|
||||
}
|
||||
if(ingredient.food){
|
||||
content.push(ingredient.food.name)
|
||||
}
|
||||
if(ingredient.note){
|
||||
content.push(`(${ingredient.note})`)
|
||||
}
|
||||
return content.join(' ')
|
||||
}
|
||||
Reference in New Issue
Block a user