{"ScriptPreparationCode":"const createItem = (value, index) =\u003E ({ id: index, label: \u0022Label\u0022 });\r\nconst payload = new Array(3).map(createItem);\r\nvar action = { payload };\r\n\r\nvar emptyValues = (source) =\u003E {\r\n const copy = {};\r\n // create an object with the same properties but empty values\r\n Object.keys(source).forEach((key) =\u003E copy[key] = typeof source[key] === \u0022string\u0022 ? \u0022\u0022 : null);\r\n return copy;\r\n};\r\n\r\nvar extractAttributes = (payload) =\u003E payload.attributes;","TestCases":[{"Name":"using extra data constant","Code":"const repository = (payload) =\u003E {\r\n const data = payload.map(extractAttributes);\r\n return [\r\n ...data.slice(0, 1).map(emptyValues),\r\n ...data\r\n ];\r\n}\r\n\r\nrepository(action.payload);","IsDeferred":false},{"Name":"without extra constant","Code":"const repository2 = (payload) =\u003E {\r\n return [\r\n ...payload.slice(0, 1).map(extractAttributes).map(emptyValues),\r\n ...payload.map(extractAttributes)\r\n ];\r\n}\r\n\r\nrepository2(action.payload);","IsDeferred":false}]}