You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
603 B
14 lines
603 B
3 years ago
|
let {ingredients, originalportioncount} = input;
|
||
|
let ing = [];
|
||
|
|
||
|
if (!Boolean(originalportioncount)) {
|
||
|
return "⚠️ <b>Warning</b>\nYou have not specified the original serving size!\n<b>Ingredient amounts cannot be estimated.</b>"
|
||
|
}
|
||
|
|
||
|
for (let i = 0; i < ingredients.length; i++) {
|
||
|
let name = ingredients[i].replace(ingredients[i].split(" ")[0] + " " + ingredients[i].split(" ")[1], "");
|
||
|
let unit = ingredients[i].split(" ")[1];
|
||
|
let amount = ingredients[i].split(" ")[0];
|
||
|
ing[i] = "🥣 " + (amount / originalportioncount * dv.current().ServingSize) + " " + unit + " <b>" + name + "</b>"
|
||
|
}
|
||
|
dv.list(ing)
|