{"ScriptPreparationCode":"var data = window.data = [];\r\nconst possible = \u0022ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.\u0022;\r\nvar TOTAL_STRINGS = window.TOTAL_STRINGS = 100000;\r\n\r\nfunction getRandomInt(max) {\r\n return Math.floor(Math.random() * max);\r\n}\r\n\r\nfunction makeRandomString(len) {\r\n var text = \u0022\u0022;\r\n for (var i = 0; i \u003C len; i\u002B\u002B) {\r\n text \u002B= possible.charAt(getRandomInt(possible.length));\r\n }\r\n return text;\r\n}\r\n\r\nfunction makeRandomUrl(len) {\r\n var url = \u0022file:///\u0022;\r\n for (var i = 0; i \u003C len; i\u002B\u002B) {\r\n url \u002B= makeRandomString(5 \u002B getRandomInt(10));\r\n if (getRandomInt(2)) {\r\n url \u002B= \u0022/\u0022;\r\n }\r\n }\r\n return url;\r\n}\r\n\r\nwhile (data.length \u003C TOTAL_STRINGS) {\r\n data.push(makeRandomUrl(getRandomInt(10)));\r\n}","TestCases":[{"Name":"regex replace normalize","Code":"var x = 0;\r\nvar TOTAL_STRINGS = window.TOTAL_STRINGS;\r\nvar data = window.data;\r\n\r\nwhile (x \u003C TOTAL_STRINGS) {\r\n const str = data[x];\r\n const url = str.replace(/\\/?$/, \u0027\u0027);\r\n x \u002B= 1;\r\n}","IsDeferred":false},{"Name":"endsWith slice normalize","Code":"var x = 0;\r\nvar TOTAL_STRINGS = window.TOTAL_STRINGS;\r\nvar data = window.data;\r\n\r\nwhile (x \u003C TOTAL_STRINGS) {\r\n const str = data[x];\r\n const url = str.endsWith(\u0022/\u0022) ? str.slice(0, -1) : str;\r\n x \u002B= 1;\r\n}","IsDeferred":false},{"Name":"slice slice normalize","Code":"var x = 0;\r\nvar TOTAL_STRINGS = window.TOTAL_STRINGS;\r\nvar data = window.data;\r\n\r\nwhile (x \u003C TOTAL_STRINGS) {\r\n const str = data[x];\r\n const url = str.slice(-1) === \u0022/\u0022 ? str.slice(0, -1) : str;\r\n x \u002B= 1;\r\n}","IsDeferred":false},{"Name":"lastIndexOf slice normalize","Code":"var x = 0;\r\nvar TOTAL_STRINGS = window.TOTAL_STRINGS;\r\nvar data = window.data;\r\n\r\nwhile (x \u003C TOTAL_STRINGS) {\r\n const str = data[x];\r\n const url = str.lastIndexOf(\u0022/\u0022) === str.length - 1 ? str.slice(0, -1) : str;\r\n x \u002B= 1;\r\n}","IsDeferred":false}]}