source: imaps-frontend/node_modules/core-js/modules/esnext.map.key-by.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 764 bytes
Line 
1'use strict';
2var $ = require('../internals/export');
3var call = require('../internals/function-call');
4var iterate = require('../internals/iterate');
5var isCallable = require('../internals/is-callable');
6var aCallable = require('../internals/a-callable');
7var Map = require('../internals/map-helpers').Map;
8
9// `Map.keyBy` method
10// https://github.com/tc39/proposal-collection-methods
11$({ target: 'Map', stat: true, forced: true }, {
12 keyBy: function keyBy(iterable, keyDerivative) {
13 var C = isCallable(this) ? this : Map;
14 var newMap = new C();
15 aCallable(keyDerivative);
16 var setter = aCallable(newMap.set);
17 iterate(iterable, function (element) {
18 call(setter, newMap, keyDerivative(element), element);
19 });
20 return newMap;
21 }
22});
Note: See TracBrowser for help on using the repository browser.