source: imaps-frontend/node_modules/core-js/modules/esnext.map.get-or-insert-computed.js

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

F4 Finalna Verzija

  • Property mode set to 100644
File size: 771 bytes
Line 
1'use strict';
2var $ = require('../internals/export');
3var aCallable = require('../internals/a-callable');
4var aMap = require('../internals/a-map');
5var MapHelpers = require('../internals/map-helpers');
6
7var get = MapHelpers.get;
8var has = MapHelpers.has;
9var set = MapHelpers.set;
10
11// `Map.prototype.getOrInsertComputed` method
12// https://github.com/tc39/proposal-upsert
13$({ target: 'Map', proto: true, real: true, forced: true }, {
14 getOrInsertComputed: function getOrInsertComputed(key, callbackfn) {
15 aMap(this);
16 aCallable(callbackfn);
17 if (has(this, key)) return get(this, key);
18 // CanonicalizeKeyedCollectionKey
19 if (key === 0 && 1 / key === -Infinity) key = 0;
20 var value = callbackfn(key);
21 set(this, key, value);
22 return value;
23 }
24});
Note: See TracBrowser for help on using the repository browser.