{"ScriptPreparationCode":"var input = [];\r\n\r\nfor (i = 2; i \u003C= 100000; i\u002B\u002B) {\r\n const date = new Date(Math.random()*1000);\r\n \r\n const value = i % 2 === 0 ? date.toISOString() : \u0027some random value\u0027;\r\n const key = i % 2 === 0 ? \u0027businessDate\u0027 : \u0027some random key\u0027;\r\n \r\n input.push({\r\n key,\r\n value\r\n });\r\n \r\n input.push({\r\n key: \u0027index\u0027,\r\n value: i\r\n });\r\n \r\n input.push({\r\n key: \u0027updatedAt\u0027,\r\n value: i\r\n });\r\n \r\n input.push({\r\n key: \u0027a\u0027,\r\n value: Math.random()\r\n });\r\n \r\n input.push({\r\n key: \u0027b\u0027,\r\n value: Math.random()\r\n });\r\n \r\n input.push({\r\n key: \u0027c\u0027,\r\n value: Math.random()\r\n });\r\n \r\n input.push({\r\n key: \u0027d\u0027,\r\n value: Math.random()\r\n });\r\n \r\n input.push({\r\n key: \u0027e\u0027,\r\n value: Math.random()\r\n });\r\n}","TestCases":[{"Name":"Baseline","Code":"const result = input.map(x=\u003E{\r\n if (typeof x.value !== \u0027string\u0027) {\r\n return x.value;\r\n }\r\n\r\n switch (x.key) {\r\n case \u0027businessDate\u0027:\r\n case \u0027startDate\u0027:\r\n case \u0027endDate\u0027:\r\n case \u0027createdAt\u0027:\r\n case \u0027updatedAt\u0027:\r\n return new Date(x.value);\r\n default:\r\n return x.value;\r\n }\r\n});","IsDeferred":false},{"Name":"Regex","Code":"const result = input.map(x=\u003E{\r\n if (typeof x.value !== \u0027string\u0027) {\r\n return x.value;\r\n }\r\n\r\n switch (x.key) {\r\n case \u0027businessDate\u0027:\r\n case \u0027startDate\u0027:\r\n case \u0027endDate\u0027:\r\n if (/(\\d{4})-(\\d{2})-(\\d{2})/.test(x.value)) { \r\n \t\treturn new Date(x.value \u002B \u0027T00:00:00.000\u0027);\r\n \t\t}\r\n return new Date(x.value);\r\n case \u0027createdAt\u0027:\r\n case \u0027updatedAt\u0027:\r\n return new Date(x.value);\r\n default:\r\n return x.value;\r\n }\r\n});","IsDeferred":false},{"Name":"No check","Code":"const result = input.map(x=\u003E{\r\n if (typeof x.value !== \u0027string\u0027) {\r\n return x.value;\r\n }\r\n\r\n switch (x.key) {\r\n case \u0027businessDate\u0027:\r\n case \u0027startDate\u0027:\r\n case \u0027endDate\u0027:\r\n return new Date(x.value \u002B \u0027T00:00:00.000\u0027);\r\n case \u0027createdAt\u0027:\r\n case \u0027updatedAt\u0027:\r\n return new Date(x.value);\r\n default:\r\n return x.value;\r\n }\r\n});","IsDeferred":false},{"Name":"Length","Code":"const result = input.map(x=\u003E{\r\n if (typeof x.value !== \u0027string\u0027) {\r\n return x.value;\r\n }\r\n\r\n switch (x.key) {\r\n case \u0027businessDate\u0027:\r\n case \u0027startDate\u0027:\r\n case \u0027endDate\u0027:\r\n if (x.value.length === 10) { \r\n \t\treturn new Date(x.value \u002B \u0027T00:00:00.000\u0027);\r\n \t\t}\r\n return new Date(x.value);\r\n case \u0027createdAt\u0027:\r\n case \u0027updatedAt\u0027:\r\n return new Date(x.value);\r\n default:\r\n return x.value;\r\n }\r\n});","IsDeferred":false}]}