{"ScriptPreparationCode":" window.existingProperties = [\r\n { \u0022bmoId\u0022 : 9931265,\r\n \u0022value\u0022 : {\r\n \u0022type\u0022 : 5,\r\n \u0022unit\u0022 : 1,\r\n \u0022value\u0022 : \u0022Level 1\u0022\r\n },\r\n \u0022definition\u0022 : {\r\n \u0022name\u0022 : \u0022Global Level\u0022,\r\n \u0022type\u0022 : 102,\r\n \u0022flags\u0022 : 3,\r\n \u0022group\u0022 : \u0022BE_GLOBAL\u0022,\r\n \u0022identifier\u0022 : \u0022\u0022\r\n }\r\n },\r\n {\r\n \u0022bmoId\u0022 : 9931264,\r\n \u0022value\u0022 : {\r\n \u0022type\u0022 : 5,\r\n \u0022unit\u0022 : 1,\r\n \u0022value\u0022 : \u0022Generic - 200mm\u0022\r\n },\r\n \u0022definition\u0022 : {\r\n \u0022name\u0022 : \u0022Global Name\u0022,\r\n \u0022type\u0022 : 101,\r\n \u0022flags\u0022 : 3,\r\n \u0022group\u0022 : \u0022BE_GLOBAL\u0022,\r\n \u0022identifier\u0022 : \u0022\u0022\r\n }\r\n },\r\n {\r\n \u0022bmoId\u0022 : 9931263,\r\n \u0022value\u0022 : {\r\n \u0022type\u0022 : 5,\r\n \u0022unit\u0022 : 1,\r\n \u0022value\u0022 : \u0022f4274632-54e9-4658-8b8b-30d6b2f5980bingo\u0022\r\n },\r\n \u0022definition\u0022 : {\r\n \u0022name\u0022 : \u0022Global BIMEYE ID\u0022,\r\n \u0022type\u0022 : 100,\r\n \u0022flags\u0022 : 3,\r\n \u0022group\u0022 : \u0022BE_GLOBAL\u0022,\r\n \u0022identifier\u0022 : \u0022\u0022\r\n }\r\n }\r\n ];\r\n// we have one same property, one new and one is updated in sync\r\n window.newProperites = [\r\n // updated property\r\n {\r\n \u0022definition\u0022 : {\r\n \u0022flags\u0022 : 3,\r\n \u0022name\u0022 : \u0022Global BIMEYE ID\u0022,\r\n \u0022group\u0022 : \u0022BE_GLOBAL\u0022,\r\n \u0022type\u0022 : 100,\r\n \u0022identifier\u0022 : \u0022\u0022\r\n },\r\n \u0022value\u0022 : {\r\n \u0022value\u0022 : \u0022f4274632-54e9-4658-8b8b-30d6b2f59801\u0022,\r\n \u0022type\u0022 : 5,\r\n \u0022unit\u0022 : 1\r\n }\r\n },\r\n // same property\r\n {\r\n \u0022definition\u0022 : {\r\n \u0022flags\u0022 : 3,\r\n \u0022name\u0022 : \u0022Global Name\u0022,\r\n \u0022group\u0022 : \u0022BE_GLOBAL\u0022,\r\n \u0022type\u0022 : 101,\r\n \u0022identifier\u0022 : \u0022\u0022\r\n },\r\n \u0022value\u0022 : {\r\n \u0022value\u0022 : \u0022Generic - 200mm\u0022,\r\n \u0022type\u0022 : 5,\r\n \u0022unit\u0022 : 1\r\n }\r\n },\r\n // new property\r\n {\r\n \u0022definition\u0022 : {\r\n \u0022flags\u0022 : 3,\r\n \u0022name\u0022 : \u0022kurcina ko greda\u0022,\r\n \u0022group\u0022 : \u0022BE_GLOBAL\u0022,\r\n \u0022type\u0022 : 102,\r\n \u0022identifier\u0022 : \u0022\u0022\r\n },\r\n \u0022value\u0022 : {\r\n \u0022value\u0022 : \u0022140000\u0022,\r\n \u0022type\u0022 : 5,\r\n \u0022unit\u0022 : 1\r\n }\r\n }\r\n ];\r\nwindow.accumulator = [];","TestCases":[{"Name":"Version 1","Code":"var updateArray = [];\r\nvar propertiesForDelete = _.intersectionWith(window.existingProperties, window.newProperites, (exp, np) =\u003E {\r\n// if props match all metadata and not value it\u0027s updated\r\nvar conditionX = (\r\n np.definition.flags === exp.definition.flags \u0026\u0026\r\n np.definition.name === exp.definition.name \u0026\u0026 \r\n np.definition.group === exp.definition.group \u0026\u0026 \r\n np.definition.type === exp.definition.type \u0026\u0026 \r\n np.definition.identifier === exp.definition.identifier \u0026\u0026\r\n np.value.type === exp.value.type \u0026\u0026\r\n np.value.unit === exp.value.unit \u0026\u0026\r\n np.value.value !== exp.value.value);\r\n if (conditionX) {\r\n updateArray.push(np);\r\n return true;\r\n }\r\n});\r\nvar removekey = \u0027bmoId\u0027\r\nvar keepKeys = [\u0027definition\u0027, \u0027value\u0027];\r\n// remove bmi key so we can match arrays\r\nvar dummyArray = existingProperties.map(({bmoId, ...keepKeys}) =\u003E keepKeys);\r\n// find which properties are new\r\nvar newPropsInSyncArray = _.differenceWith(_.differenceWith(window.newProperites, dummyArray, _.isEqual), updateArray, _.isEqual);\r\n","IsDeferred":false},{"Name":"Version 2","Code":" var up2 = [];\r\n var del2 = [];\r\n var newPropsInSyncArrayMod = _.differenceWith(window.newProperites, window.existingProperties, (np, {bmoId, definition, value}) =\u003E {\r\n var conditionY = (\r\n np.definition.flags === definition.flags \u0026\u0026\r\n np.definition.name === definition.name \u0026\u0026\r\n np.definition.group === definition.group \u0026\u0026\r\n np.definition.type === definition.type \u0026\u0026\r\n np.definition.identifier === definition.identifier \u0026\u0026\r\n np.value.type === value.type \u0026\u0026\r\n np.value.unit === value.unit);\r\n if (conditionY) {\r\n if (np.value.value !== value.value) {\r\n up2.push(np);\r\n del2.push({definition, value});\r\n }\r\n return true;\r\n }\r\n return false;\r\n });","IsDeferred":false}]}