{"ScriptPreparationCode":null,"TestCases":[{"Name":"first, synchrone","Code":"const researchBarr = document.getElementById(\u0027searchbarr\u0027);\r\n\r\n\r\nfunction recipesNames(recipes, word){\r\n return recipes.filter(recipe =\u003E recipe.name.toUpperCase().includes(word.toUpperCase()));\r\n}\r\n\r\n\r\nfunction recipesIngredients (recipes, word){\r\n return recipes.filter(recipe =\u003E recipe.ingredients.some(ingredient =\u003E ingredient.ingredient.toUpperCase().includes(word.toUpperCase())));\r\n}\r\n\r\n\r\nfunction recipesDescriptions (recipes, word){\r\n return recipes.filter(recipe =\u003E recipe.description.toUpperCase().includes(word.toUpperCase()))\r\n}\r\n\r\nfunction globalValue(word){\r\n var globalArray = recipesNames(recipes, word).concat(recipesIngredients(recipes, word), recipesDescriptions(recipes, word));\r\n return [...new Set(globalArray)];\r\n}\r\n\r\n\r\n\r\nresearchBarr.addEventListener(\u0027input\u0027, function (){\r\n var searchValue = this.value;\r\n if(searchValue.length\u003E= 3){\r\n loadRecipes(globalValue(searchValue));\r\n }else if(searchValue.length == 0){\r\n loadRecipes(recipes);\r\n }\r\n})","IsDeferred":false},{"Name":"second, async","Code":"const researchBarr = document.getElementById(\u0027searchbarr\u0027);\r\n\r\n\r\nasync function recipesNames(recipes, word){\r\n return recipes.filter(recipe =\u003E recipe.name.toUpperCase().includes(word.toUpperCase()));\r\n}\r\n\r\n\r\nasync function recipesIngredients (recipes, word){\r\n return recipes.filter(recipe =\u003E recipe.ingredients.some(ingredient =\u003E ingredient.ingredient.toUpperCase().includes(word.toUpperCase())));\r\n}\r\n\r\n\r\nasync function recipesDescriptions (recipes, word){\r\n return recipes.filter(recipe =\u003E recipe.description.toUpperCase().includes(word.toUpperCase()))\r\n}\r\n\r\nfunction globalValue(word){\r\n var globalArray = recipesNames(recipes, word).concat(recipesIngredients(recipes, word), recipesDescriptions(recipes, word));\r\n return [...new Set(globalArray)];\r\n}\r\n\r\n\r\n\r\nresearchBarr.addEventListener(\u0027input\u0027, async function (){\r\n var searchValue = this.value;\r\n if(searchValue.length\u003E= 3){\r\n\r\n await SearchAsync.globalValue(searchValue)\r\n loadRecipes(SearchAsync.result);\r\n }else if(searchValue.length == 0){\r\n loadRecipes(recipes);\r\n }\r\n})\r\n\r\nclass SearchAsync {\r\n\r\n static async globalValue (word){\r\n this.result = [];\r\n recipesNames(recipes, word).then(filterRecipe =\u003E SearchAsync.checkSearch(filterRecipe));\r\n recipesIngredients (recipes, word).then(filterRecipe =\u003E SearchAsync.checkSearch(filterRecipe));\r\n recipesDescriptions (recipes, word).then(filterRecipe =\u003E SearchAsync.checkSearch(filterRecipe));\r\n }\r\n\r\n static checkSearch(filterRecipe){\r\n this.result = [...new Set(this.result.concat(filterRecipe))];\r\n }\r\n}","IsDeferred":false}]}