{"ScriptPreparationCode":"var arr_userTags = [\u0022freq/5\u0022, \u0022lifetime_subscriptions/3\u002B\u0022, \u0022freq_beverages/0\u0022, \u0022active_plans/1\u002B\u0022, \u0022active_beverages_plans/0\u0022, \u0022freq_first/bronze\u0022, \u0022freq_first_bucket/5\u0022, \u0022current_freq_90d/13\u0022, \u0022freq_first_5_8/freq\u003C9\u0022, \u0022freq_first_5-8/freq_5-8\u0022, \u0022freq_first_5-8\u0022, \u0022current_freq_90d/10\u002B\u0022, \u0022freq/5-8\u0022, \u0022beverage/new\u0022, \u0022aov_90d/40-45\u0022, \u0022aov_lifetime/45-50\u0022, \u0022has_voucher_coca\u0022, \u0022coca_lover/\u003E3\u0022, \u0022clubber_lifecycle/active\u0022, \u0022no_itau_purchases\u0022, \u0022smart_cmp_coverage/middle\u0022, \u0022smart_cmp_coverage_tier/middle\u0022, \u0022drink_lover/\u003E3\u0022, \u0022guarana_lover/1\u0022, \u0022user_had_vip\u0022, \u0022months_with_club_subscriptions/4\u002B\u0022, \u0022used_mastercard_last_month\u0022, \u0022is_vip\u0022, \u0022months_with_club_orders/4\u0022, \u0022ifood_beneficios\u0022, \u0022completed_voucher_uses\u0022, \u0022months_with_vip/1\u0022, \u0022top_city/tier3_high\u0022, \u0022smart_campaign/active\u0022, \u0022club_profile/engajado\u0022, \u0022cms/b\u0022];\r\nvar arr_includeAll = [\u0027drink_lover/\u003E3\u0027, \u0027months_with_vip/1\u0027];\r\n\r\nfunction randomInt(min, max) {\r\n return Math.floor(Math.random() * (max - min \u002B 1) \u002B min);\r\n}\r\n\r\nfunction sort(arr, property) {\r\n return [...arr].sort((a, b) =\u003E (a[property] \u003E b[property]) ? 1 : ((a[property] === b[property]) ? 0 : -1));\r\n}\r\n\r\nvar groups = [];\r\nvar maxGroups = 550;\r\nvar searchId = 210;\r\n\r\nfor (let i = 0; i \u003C maxGroups; i \u002B= 1) {\r\n\tgroups.push({\r\n\t\tid: i,\r\n priority: randomInt(2, 999),\r\n includeAll: [\u0027drink_lover/\u003E3\u0027, \u0027months_with_vip/1\u0027],\r\n excludeAll: [\u0027anything/0-5\u0027],\r\n includeAny: [],\r\n excludeAny: [],\r\n\t});\r\n}\r\n\r\nvar sortedGroups = sort(groups, \u0027priority\u0027);","TestCases":[{"Name":"filter","Code":"const filteredGroups = groups.filter((group) =\u003E {\r\n group.includeAll.every(tag =\u003E arr_userTags.includes(tag));\r\n \tgroup.excludeAll.every(tag =\u003E !arr_userTags.includes(tag));\r\n \tgroup.includeAny.some(tag =\u003E arr_userTags.includes(tag));\r\n\tgroup.excludeAny.some(tag =\u003E !arr_userTags.includes(tag));\r\n \r\n\treturn group.id === searchId;\r\n});\r\n\r\nconst [group] = sort(filteredGroups, \u0027priority\u0027);","IsDeferred":false},{"Name":"find","Code":"const group = sortedGroups.find((group) =\u003E {\r\n group.includeAll.every(tag =\u003E arr_userTags.includes(tag));\r\n \tgroup.excludeAll.every(tag =\u003E !arr_userTags.includes(tag));\r\n \tgroup.includeAny.some(tag =\u003E arr_userTags.includes(tag));\r\n\tgroup.excludeAny.some(tag =\u003E !arr_userTags.includes(tag));\r\n\r\n\treturn group.id === searchId;\r\n});","IsDeferred":false},{"Name":"for...of","Code":"let result;\r\n\r\nfor (const group of sortedGroups) {\r\n group.includeAll.every(tag =\u003E arr_userTags.includes(tag));\r\n \tgroup.excludeAll.every(tag =\u003E !arr_userTags.includes(tag));\r\n \tgroup.includeAny.some(tag =\u003E arr_userTags.includes(tag));\r\n\tgroup.excludeAny.some(tag =\u003E !arr_userTags.includes(tag));\r\n\r\n\tif (group.id === searchId) {\r\n result = group;\r\n\t\tbreak;\r\n\t}\r\n}","IsDeferred":false}]}