{"ScriptPreparationCode":"var { compose, over, set, lensPath, append } = R\r\n\r\nvar INITIAL_DATA = { items: {}, count: 0, keys: [] }\r\n\r\nfor (var index = 0; index \u003C 100; index\u002B\u002B) {\r\n INITIAL_DATA.items[index] = { id: index, name: \u0060ITEM-${index}\u0060, value: Math.random() }\r\n INITIAL_DATA.count\u002B\u002B\r\n INITIAL_DATA.keys.push(index)\r\n}\r\n\r\nvar NEW_ITEM_ID = INITIAL_DATA.count \u002B1\r\n\r\nvar produce = immer.default\r\nimmer.setAutoFreeze(false)\r\n\r\nvar INITIAL_DATA_I = Immutable({ items: INITIAL_DATA.items, count: INITIAL_DATA.count, keys: Immutable(INITIAL_DATA.keys)})","TestCases":[{"Name":"immer","Code":"data = produce(INITIAL_DATA, draft =\u003E {\r\n draft.items[NEW_ITEM_ID] = { id: NEW_ITEM_ID, name: \u0027ITEM-NEW\u0027, value: 0 }\r\n draft.counter\u002B\u002B\r\n draft.keys.push(NEW_ITEM_ID)\r\n})","IsDeferred":false},{"Name":"shallow copy","Code":"data = {\r\n ...INITIAL_DATA,\r\n items: {\r\n \t...INITIAL_DATA.items,\r\n \t[NEW_ITEM_ID]: { id: NEW_ITEM_ID, name: \u0027ITEM-NEW\u0027, value: 0 }\r\n },\r\n count: INITIAL_DATA.count \u002B1,\r\n keys: [ ...INITIAL_DATA.keys, NEW_ITEM_ID]\r\n}","IsDeferred":false},{"Name":"ramda lens","Code":"data = compose(\r\n over(lensPath([\u0022keys\u0022]), append(NEW_ITEM_ID)),\r\n over(lensPath([\u0022count\u0022]), x =\u003E x \u002B 1),\r\n set(lensPath([\u0022items\u0022, NEW_ITEM_ID]), {\r\n id: NEW_ITEM_ID,\r\n name: \u0022ITEM-NEW\u0022,\r\n value: 0\r\n })\r\n )(INITIAL_DATA);","IsDeferred":false},{"Name":"samless","Code":"data = INITIAL_DATA_I\r\n .setIn([\u0027keys\u0027], NEW_ITEM_ID)\r\n .setIn([\u0027count\u0027],INITIAL_DATA_I.count \u002B1)\r\n .setIn([\u0027items\u0027, NEW_ITEM_ID], { id: NEW_ITEM_ID, name: \u0027ITEM-NEW\u0027, value: 0 })","IsDeferred":false}]}