Son CV dans un terminal web en Javascript!
https://terminal-cv.gregandev.fr
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
605 B
20 lines
605 B
1 year ago
|
'use strict';
|
||
|
var $ = require('../internals/export');
|
||
|
var call = require('../internals/function-call');
|
||
|
var iterate = require('../internals/iterate');
|
||
|
var aCallable = require('../internals/a-callable');
|
||
|
|
||
|
// `Map.keyBy` method
|
||
|
// https://github.com/tc39/proposal-collection-methods
|
||
|
$({ target: 'Map', stat: true }, {
|
||
|
keyBy: function keyBy(iterable, keyDerivative) {
|
||
|
var newMap = new this();
|
||
|
aCallable(keyDerivative);
|
||
|
var setter = aCallable(newMap.set);
|
||
|
iterate(iterable, function (element) {
|
||
|
call(setter, newMap, keyDerivative(element), element);
|
||
|
});
|
||
|
return newMap;
|
||
|
}
|
||
|
});
|