⚝
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
/
nodejs
/
core-js
/
internals
/
View File Name :
array-group-to-map.js
'use strict'; var getBuiltIn = require('../internals/get-built-in'); var bind = require('../internals/function-bind-context'); var uncurryThis = require('../internals/function-uncurry-this'); var IndexedObject = require('../internals/indexed-object'); var toObject = require('../internals/to-object'); var lengthOfArrayLike = require('../internals/length-of-array-like'); var Map = getBuiltIn('Map'); var MapPrototype = Map.prototype; var mapGet = uncurryThis(MapPrototype.get); var mapHas = uncurryThis(MapPrototype.has); var mapSet = uncurryThis(MapPrototype.set); var push = uncurryThis([].push); // `Array.prototype.groupToMap` method // https://github.com/tc39/proposal-array-grouping module.exports = function groupToMap(callbackfn /* , thisArg */) { var O = toObject(this); var self = IndexedObject(O); var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); var map = new Map(); var length = lengthOfArrayLike(self); var index = 0; var key, value; for (;length > index; index++) { value = self[index]; key = boundFunction(value, index, O); if (mapHas(map, key)) push(mapGet(map, key), value); else mapSet(map, key, [value]); } return map; };