caring about {[( and ingredinents with numbers like "vitamin B1"
function glutenDetector(ingredients){ const gluten = [ "wheat", "wheat flour", "triticale", "barley", "rye", "brewer's yeast", "malt", "wheatberries", "durum", "emmer", "semolina", "spelt", "farina", "farro", "graham", "kamut", "einkorn" ]; return ingredients .toLowerCase() .split(/[^\w\d]{2,}/) .some(x => gluten.includes(x)); }
- function glutenDetector(ingredients){
- const gluten = [
- "wheat",
- "wheat flour",
- "triticale",
- "barley",
- "rye",
- "brewer's yeast",
- "malt",
- "wheatberries",
- "durum",
- "emmer",
- "semolina",
- "spelt",
- "farina",
- "farro",
- "graham",
- "kamut",
- "einkorn"
- ];
- return ingredients
- .toLowerCase()
.split(/[,\s]+/)- .split(/[^\w\d]{2,}/)
- .some(x => gluten.includes(x));
- }
function glutenDetector(ingredients){ const gluten = [ "wheat", "wheat flour", "triticale", "barley", "rye", "brewer's yeast", "malt", "wheatberries", "durum", "emmer", "semolina", "spelt", "farina", "farro", "graham", "kamut", "einkorn" ]; return gluten.some(g=>ingredients.includes(g.toUpperCase())); }
- function glutenDetector(ingredients){
- const gluten = [
- "wheat",
- "wheat flour",
- "triticale",
- "barley",
- "rye",
- "brewer's yeast",
- "malt",
- "wheatberries",
- "durum",
- "emmer",
- "semolina",
- "spelt",
- "farina",
- "farro",
- "graham",
- "kamut",
- "einkorn"
- ];
return ingredients.split(/[,()]/).map((el) => el.trim().toLowerCase()).some((el) => gluten.includes(el));- return gluten.some(g=>ingredients.includes(g.toUpperCase()));
- }