{"ScriptPreparationCode":"Array.from(Array(100).keys()).map((i) =\u003E ({\r\n id: i\u002B1,\r\n name: \u0027Bar\u0027,\r\n asd: 123123\r\n}));\r\n\r\nArray.from(Array(50).keys()).map((i) =\u003E ({\r\n id: i\u002B5,\r\n title: \u0027Bar\u0027,\r\n age: 12\r\n}));","TestCases":[{"Name":"Object based","Code":"const normalizeLiveUpdateData = (\r\n newData, \r\n oldaData\r\n) =\u003E {\r\n\r\n if (!oldAnnotations) return newAnnotations;\r\n\r\n const ids = [];\r\n const data = {};\r\n\r\n oldAnnotations.forEach((a) =\u003E {\r\n ids.push(a.id);\r\n data[a.id] = a;\r\n });\r\n\r\n newAnnotations.forEach((a) =\u003E {\r\n if (ids.indexOf(a.id) === -1) {\r\n ids.push(a.id);\r\n }\r\n data[a.id] = a;\r\n });\r\n\r\n return ids.map(id =\u003E data[id]);\r\n};","IsDeferred":false},{"Name":"Array based","Code":"const normalizeLiveUpdateData = (\r\n newAnnotations, oldAnnotations) =\u003E {\r\n\r\n if (!oldAnnotations) return newAnnotations;\r\n\r\n let normalizedAnnotations = oldAnnotations;\r\n\r\n newAnnotations.forEach((newAnnotation) =\u003E {\r\n const existingAnnotation = oldAnnotations.find((oldAnnotation) =\u003E oldAnnotation.id === newAnnotation.id);\r\n if (existingAnnotation) {\r\n normalizedAnnotations = normalizedAnnotations.map(obj =\u003E newAnnotations.find(o =\u003E o.id === obj.id) || obj);\r\n } else {\r\n normalizedAnnotations.push(newAnnotation);\r\n }\r\n });\r\n\r\n return normalizedAnnotations;\r\n};","IsDeferred":false}]}