const {globalFunc} = customJS;
let {items} = input;
let ing = [];
let j = 0;
if (!Boolean(items)) {
return "⚠️ Warning\nYou have not specified shopping items!\nThe shopping list cannot be printed."
}
for (let i = 0; i < items.length; i++) {
let name = items[i].replace(items[i].split(" ")[0] + " " + items[i].split(" ")[1]+ " " + items[i].split(" ")[2], "");
let unit = items[i].split(" ")[2];
if (unit.contains('whole')) {unit = ""}
let amount = items[i].split(" ")[1];
let emoji = items[i].split(" ")[0];
if (amount > 0) {
ing[j] = emoji + " " + amount + " " + unit + " " + name + ""
j++
}
}
if (ing.length == 0) {
return dv.el('p', "✌️ No shopping item to display")
}
dv.el('p', globalFunc.BuildList(ing, "\n"))