{"ScriptPreparationCode":"var MyArr = Array.from({length: 40}, () =\u003E Math.floor(Math.random() * 40));\r\n\r\nvar myCopy = null;\r\n\r\nfunction uniqBy(arr, predicate) {\r\n const cb = typeof predicate === \u0027function\u0027 ? predicate : (o) =\u003E o[predicate];\r\n \r\n return [...arr.reduce((map, item) =\u003E {\r\n const key = (item === null || item === undefined) ? \r\n item : cb(item);\r\n \r\n map.has(key) || map.set(key, item);\r\n \r\n return map;\r\n }, new Map()).values()];\r\n};\r\n","TestCases":[{"Name":"Lodash uniqBy","Code":"myCopy = _.uniqBy(MyArr);","IsDeferred":false},{"Name":"Set","Code":"myCopy = [...new Set(MyArr)]","IsDeferred":false},{"Name":"custom uniqBy","Code":"myCopy = uniqBy(MyArr, v =\u003E v)","IsDeferred":false}]}