⚝
One Hat Cyber Team
⚝
Your IP:
172.22.0.1
Server IP:
151.80.20.34
Server:
Linux 794f04d97d5e 5.15.0-143-generic #153-Ubuntu SMP Fri Jun 13 19:10:45 UTC 2025 x86_64
Server Software:
Apache/2.4.62 (Debian)
PHP Version:
8.2.28
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
node_modules
/
core-js
/
internals
/
View File Name :
array-unique-by.js
'use strict'; var getBuiltIn = require('../internals/get-built-in'); var uncurryThis = require('../internals/function-uncurry-this'); var aCallable = require('../internals/a-callable'); var isNullOrUndefined = require('../internals/is-null-or-undefined'); var lengthOfArrayLike = require('../internals/length-of-array-like'); var toObject = require('../internals/to-object'); var arraySpeciesCreate = require('../internals/array-species-create'); var Map = getBuiltIn('Map'); var MapPrototype = Map.prototype; var mapForEach = uncurryThis(MapPrototype.forEach); var mapHas = uncurryThis(MapPrototype.has); var mapSet = uncurryThis(MapPrototype.set); var push = uncurryThis([].push); // `Array.prototype.uniqueBy` method // https://github.com/tc39/proposal-array-unique module.exports = function uniqueBy(resolver) { var that = toObject(this); var length = lengthOfArrayLike(that); var result = arraySpeciesCreate(that, 0); var map = new Map(); var resolverFunction = !isNullOrUndefined(resolver) ? aCallable(resolver) : function (value) { return value; }; var index, item, key; for (index = 0; index < length; index++) { item = that[index]; key = resolverFunction(item); if (!mapHas(map, key)) mapSet(map, key, item); } mapForEach(map, function (value) { push(result, value); }); return result; };