{"ScriptPreparationCode":"const input = \u0027{\u0022date\u0022:\u00222024-11-19T20:36:29.668Z\u0022,\u0022status\u0022:\u0022success\u0022,\u0022time\u0022:\u00224.56s\u0022}\r\n{\u0022date\u0022:\u00222024-11-20T17:05:07.177Z\u0022,\u0022status\u0022:\u0022success\u0022,\u0022time\u0022:\u00220.00s\u0022}\r\n{\u0022date\u0022:\u00222024-11-20T17:14:26.737Z\u0022,\u0022status\u0022:\u0022success\u0022,\u0022time\u0022:\u00220.00s\u0022}\r\n{\u0022date\u0022:\u00222024-11-20T17:16:45.236Z\u0022,\u0022status\u0022:\u0022initiated\u0022}\r\n{\u0022date\u0022:\u00222024-11-20T17:16:47.353Z\u0022,\u0022status\u0022:\u0022success\u0022,\u0022time\u0022:\u00220.00s\u0022}\r\n{\u0022date\u0022:\u00222024-11-20T19:26:51.544Z\u0022,\u0022status\u0022:\u0022initiated\u0022}\r\n{\u0022date\u0022:\u00222024-11-20T19:26:53.456Z\u0022,\u0022status\u0022:\u0022success\u0022,\u0022time\u0022:\u00220.00s\u0022}\r\n\r\n\u0027;\r\n\r\nexport const parseLogsLoop = (input) =\u003E {\r\n const rawLogs = input.split(\u0022\\n\u0022);\r\n\r\n const parsedLogs = [];\r\n\r\n for (const log of rawLogs) {\r\n if (!log) continue;\r\n\r\n const parsedLog = JSON.parse(log);\r\n\r\n parsedLogs.unshift(parsedLog);\r\n }\r\n\r\n return parsedLogs;\r\n};\r\n\r\nconst parseLogsChain = (input) =\u003E {\r\n\treturn input\r\n .split(\u0022\\n\u0022)\r\n .filter((entry) =\u003E entry)\r\n .map((entry) =\u003E JSON.parse(entry.trim()))\r\n .sort((a, b) =\u003E new Date(b.date).getTime() - new Date(a.date).getTime())\r\n}","TestCases":[{"Name":"parseLogsLoop","Code":"parseLogsLoop(input);","IsDeferred":false},{"Name":"parseLogsChain","Code":"parseLogsChain(input);","IsDeferred":false}]}