{"ScriptPreparationCode":"var namespaces = [];\r\nfor (var i = 0; i \u003C 10000; i\u002B\u002B) {\r\n let predicate = Math.random();\r\n let level = \u0027\u0027;\r\n if (predicate \u003C 0.25) {\r\n level = \u0027:error\u0027;\r\n } else if (predicate \u003C 0.5) {\r\n level = \u0027:warn\u0027;\r\n } else if (predicate \u003C 0.75) {\r\n level = \u0027:verbose\u0027;\r\n }\r\n const off = Math.random() \u003C 0.5;\r\n namespaces.push(\u0060${off}LH:${Math.floor(Math.random() * 1000)}${level}\u0060);\r\n}","TestCases":[{"Name":"sort-map","Code":"const rules = namespaces\r\n .sort()\r\n .map((namespace) =\u003E {\r\n let enabled = true;\r\n if (\u0027-\u0027 === namespace[0]) {\r\n namespace = namespace.slice(1);\r\n enabled = false;\r\n }\r\n\treturn {text: namespace, pattern: new RegExp(\u0060^${namespace}$\u0060), enabled};\r\n });","IsDeferred":false},{"Name":"reduce","Code":"const rules = namespaces\r\n .reduce((rules, namespace) =\u003E {\r\n let enabled = true;\r\n if (\u0027-\u0027 === namespace[0]) {\r\n namespace = namespace.slice(1);\r\n enabled = false;\r\n }\r\n const rule = {text: namespace, pattern: new RegExp(\u0060^${namespace}$\u0060), enabled}; \r\n \tconst nextIndex = rules.findIndex((rule) =\u003E namespace.length \u003C rule.text.length);\r\n const index = nextIndex \u003E -1 ? nextIndex : rules.length;\r\n rules.splice(index, 0, rule);\r\n return rules;\r\n }, []);","IsDeferred":false}]}