{"ScriptPreparationCode":"var fieldMappings = {\r\n \u00A0 first_name: {formFieldName:\u0027fieldname1\u0027, DNBMap:\u0027dnbmap1\u0027},\r\n \u00A0\u00A0last_name: {formFieldName:\u0027fieldname1\u0027, DNBMap:\u0027dnbmap2\u0027},\r\n \u00A0 alias3: {formFieldName:\u0027fieldname2\u0027, DNBMap:\u0027dnbmap3\u0027}\r\n}\r\n\r\n\r\n\r\nvar response = {\r\n \u00A0\u00A0 first_name: \u0027field1Valuefst\u0027,\r\n \u00A0\u00A0 last_name: \u0027field1Valuelst\u0027,\r\n \u00A0\u00A0 alias3: \u0027field2Value\u0027\r\n}\r\n\r\n function nameFromResponse(response) {\r\n return Object\r\n .keys(response)\r\n .filter(key =\u003E key === \u0027first_name\u0027 || key === \u0027last_name\u0027)\r\n .map(key =\u003E response[key]).join(\u0027 \u0027);\r\n }","TestCases":[{"Name":"native","Code":"let massagedResponse = {};\r\n\r\n let nameFieldName = fieldMappings.first_name.formFieldName;\r\n massagedResponse[nameFieldName] = nameFromResponse(response);\r\n\r\n Object.keys(response).filter(value =\u003E value !== \u0027first_name\u0027 \u0026\u0026 value !== \u0027last_name\u0027).forEach(key =\u003E {\r\n massagedResponse[fieldMappings[key].formFieldName] = response[key];\r\n });\r\n\r\n\r\n","IsDeferred":false},{"Name":"lodash","Code":"_(response)\r\n .mapValues(i=\u003E{return{value: i}})\r\n .merge(fieldMappings)\r\n .groupBy(\u0027formFieldName\u0027)\r\n .mapValues(j=\u003E_.map(j, \u0027value\u0027).join(\u0027 \u0027))\r\n.value()\r\n\r\n","IsDeferred":false}]}