2 var getBuiltIn = require('../internals/get-built-in');
3 var uncurryThis = require('../internals/function-uncurry-this');
4 var aCallable = require('../internals/a-callable');
5 var lengthOfArrayLike = require('../internals/length-of-array-like');
6 var toObject = require('../internals/to-object');
7 var arraySpeciesCreate = require('../internals/array-species-create');
9 var Map = getBuiltIn('Map');
10 var MapPrototype = Map.prototype;
11 var mapForEach = uncurryThis(MapPrototype.forEach);
12 var mapHas = uncurryThis(MapPrototype.has);
13 var mapSet = uncurryThis(MapPrototype.set);
14 var push = uncurryThis([].push);
16 // `Array.prototype.uniqueBy` method
17 // https://github.com/tc39/proposal-array-unique
18 module.exports = function uniqueBy(resolver) {
19 var that = toObject(this);
20 var length = lengthOfArrayLike(that);
21 var result = arraySpeciesCreate(that, 0);
23 var resolverFunction = resolver != null ? aCallable(resolver) : function (value) {
27 for (index = 0; index < length; index++) {
29 key = resolverFunction(item);
30 if (!mapHas(map, key)) mapSet(map, key, item);
32 mapForEach(map, function (value) {