{"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 sortBy = (key) =\u003E {\r\n return (a, b) =\u003E (a[key] \u003E b[key]) ? 1 : (b[key] \u003E a[key] ? -1 : 0);\r\n};\r\n\r\nconst uniqBy = (arr, a) =\u003E {\r\n arr.sort(sortBy(a));\r\n const arr1 = [];\r\n arr1.push(arr[0]);\r\n for (let index = 1; index \u003C arr.length; index\u002B\u002B) {\r\n if (arr[index-1] \u0026\u0026 arr[index -1].a !== arr[index].a) {\r\n arr1.push(arr[index]);\r\n }\r\n }\r\n return arr1;\r\n}\r\nuniqBy(data, \u0027a\u0027)","IsDeferred":false}]}