{"ScriptPreparationCode":null,"TestCases":[{"Name":"Current with RegExp","Code":"const strip = (itemSlug, locale) =\u003E {\r\n let slugWithLocale = locale ? locale \u002B \u0027/\u0027 \u002B itemSlug : itemSlug;\r\n slugWithLocale = slugWithLocale.replace(/\\/?index$/, \u0027\u0027);\r\n return slugWithLocale;\r\n}\r\n\r\nstrip(\u0027foo\u0027);\r\nstrip(\u0027foo\u0027, \u0027fr\u0027);\r\nstrip(\u0027index\u0027);\r\nstrip(\u0027index\u0027, \u0027fr\u0027);\r\nstrip(\u0027guides/getting-started\u0027);\r\nstrip(\u0027guides/getting-started\u0027, \u0027fr\u0027);","IsDeferred":false},{"Name":"Simpler without replace","Code":"const strip = (itemSlug, locale) =\u003E {\r\n \tconst slug = itemSlug === \u0027index\u0027 ? \u0027\u0027 : itemSlug;\r\n\treturn locale ? (slug ? locale \u002B \u0027/\u0027 \u002B slug : locale) : slug;\r\n}\r\n\r\nstrip(\u0027foo\u0027);\r\nstrip(\u0027foo\u0027, \u0027fr\u0027);\r\nstrip(\u0027index\u0027);\r\nstrip(\u0027index\u0027, \u0027fr\u0027);\r\nstrip(\u0027guides/getting-started\u0027);\r\nstrip(\u0027guides/getting-started\u0027, \u0027fr\u0027);","IsDeferred":false}]}