{"ScriptPreparationCode":"var data = [{a: 1}, {a: 2}, {a: 3}, {a: 4}, {a: 5}, {a: 6}, {a: 7}, {a: 8}, {a: 1}];","TestCases":[{"Name":"lodash","Code":"_.uniqBy(data, \u0027a\u0027);","IsDeferred":false},{"Name":"javascript","Code":"const uniqueBy = (array, fieldName) =\u003E {\r\n const uniqueArr = [];\r\n const addedFields = {};\r\n\r\n array.forEach((el) =\u003E {\r\n if (addedFields[fieldName]) {\r\n return;\r\n }\r\n addedFields[el[fieldName]] = true;\r\n uniqueArr.push(el);\r\n })\r\n return uniqueArr;\r\n}\r\nuniqueBy(data, \u0027a\u0027)","IsDeferred":false}]}