{"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}","TestCases":[{"Name":"1","Code":"const result = input.map(x=\u003E{\r\n if (\r\n typeof x.value === \u0027string\u0027\r\n \u0026\u0026\r\n (x.key === \u0027businessDate\u0027\r\n || x.key=== \u0027startDate\u0027\r\n || x.key === \u0027endDate\u0027\r\n || x.key === \u0027updatedAt\u0027) \r\n ) { \r\n return new Date(x.value);\r\n }\r\n return x.value;\r\n});","IsDeferred":false},{"Name":"2","Code":"const result = input.map(x=\u003E{\r\n if (typeof x.value === \u0027string\u0027) { \r\n const date = new Date(x.value);\r\n \r\n return isNaN(date)\r\n\t\t? x.value\r\n \t: date;\r\n }\r\n \r\n return x.value;\r\n});","IsDeferred":false},{"Name":"3","Code":"const result = input.map(x=\u003E{\r\n if (x.key.endsWith(\u0027Date\u0027) \u0026\u0026 typeof x.value === \u0027string\u0027) { \r\n return new Date(x.value);\r\n }\r\n return x.value;\r\n});","IsDeferred":false},{"Name":"4","Code":"const result = input.map(x=\u003E{\r\n if (typeof x.value === \u0027string\u0027 \u0026\u0026 /(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})/.test(x.value)) { \r\n return new Date(x.value);\r\n }\r\n return x.value;\r\n});","IsDeferred":false},{"Name":"5","Code":"const result = input.map(x=\u003E{\r\n if (/(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})/.test(x.value)) { \r\n return new Date(x.value);\r\n }\r\n return x.value;\r\n});","IsDeferred":false},{"Name":"6","Code":"const dateFields = [\u0027businessDate\u0027, \u0027startDate\u0027, \u0027endDate\u0027, \u0027updatedAt\u0027]\r\n\r\nconst result = input.map(x=\u003E{\r\n if (dateFields.includes(x.key)) { \r\n return new Date(x.value);\r\n }\r\n return x.value;\r\n});","IsDeferred":false},{"Name":"7","Code":"const dateFields = [\u0027businessDate\u0027, \u0027startDate\u0027, \u0027endDate\u0027, \u0027updatedAt\u0027]\r\n\r\nconst result = input.map(x=\u003E{\r\n if (dateFields.includes(x.key) \u0026\u0026 typeof x.value === \u0027string\u0027) { \r\n return new Date(x.value);\r\n }\r\n return x.value;\r\n});","IsDeferred":false},{"Name":"8","Code":"const dateFields = new Set([\u0027businessDate\u0027, \u0027startDate\u0027, \u0027endDate\u0027, \u0027updatedAt\u0027]);\r\n\r\nconst result = input.map(x=\u003E{\r\n if (dateFields.has(x.key) \u0026\u0026 typeof x.value === \u0027string\u0027) { \r\n return new Date(x.value);\r\n }\r\n return x.value;\r\n});","IsDeferred":false},{"Name":"9","Code":"const dateFields = [\u0027businessDate\u0027, \u0027startDate\u0027, \u0027endDate\u0027, \u0027updatedAt\u0027]\r\n\r\nconst result = input.map(x=\u003E{\r\n if (dateFields.includes(x.key) \u0026\u0026 typeof x.value === \u0027string\u0027) { \r\n const date = new Date(x.value);\r\n return isNaN(date)\r\n ? x.Value\r\n : date;\r\n }\r\n return x.value;\r\n});","IsDeferred":false},{"Name":"10","Code":"const dateFields = [\u0027businessDate\u0027, \u0027startDate\u0027, \u0027endDate\u0027, \u0027updatedAt\u0027]\r\n\r\nconst result = input.map(x=\u003E{\r\n if (dateFields.includes(x.key) \u0026\u0026 typeof x.value === \u0027string\u0027 \u0026\u0026 /(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})/.test(x.value)) { \r\n return new Date(x.value);\r\n }\r\n return x.value;\r\n});","IsDeferred":false},{"Name":"11","Code":"const dateFields = [\u0027businessDate\u0027, \u0027startDate\u0027, \u0027endDate\u0027, \u0027updatedAt\u0027]\r\n\r\nconst result = input.map(x=\u003E{\r\n if (dateFields.includes(x.key) \u0026\u0026 /(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})/.test(x.value)) { \r\n return new Date(x.value);\r\n }\r\n return x.value;\r\n});","IsDeferred":false},{"Name":"12","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 if (x.key === \u0027businessDate\u0027\r\n || x.key=== \u0027startDate\u0027\r\n || x.key === \u0027endDate\u0027\r\n || x.key === \u0027updatedAt\u0027 \r\n ){\r\n return new Date(x.value);\r\n }\r\n return x.value; \r\n});","IsDeferred":false},{"Name":"13","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 \u0027updatedAt\u0027:\r\n return new Date(x.value);\r\n break;\r\n default:\r\n return x.value;\r\n break;\r\n } \r\n});","IsDeferred":false},{"Name":"14","Code":"const result = input.map(x=\u003E{\r\n switch (x.key){\r\n case \u0027businessDate\u0027:\r\n case \u0027startDate\u0027:\r\n case \u0027endDate\u0027:\r\n case \u0027updatedAt\u0027:\r\n if (typeof x.value === \u0027string\u0027){\r\n \treturn new Date(x.value);\r\n \t } \r\n return x.value;\r\n break;\r\n default:\r\n return x.value;\r\n break;\r\n } \r\n});","IsDeferred":false}]}