source: imaps-frontend/node_modules/core-js/modules/esnext.weak-map.get-or-insert.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: 571 bytes
Line 
1'use strict';
2var $ = require('../internals/export');
3var aWeakMap = require('../internals/a-weak-map');
4var WeakMapHelpers = require('../internals/weak-map-helpers');
5
6var get = WeakMapHelpers.get;
7var has = WeakMapHelpers.has;
8var set = WeakMapHelpers.set;
9
10// `WeakMap.prototype.getOrInsert` method
11// https://github.com/tc39/proposal-upsert
12$({ target: 'WeakMap', proto: true, real: true, forced: true }, {
13 getOrInsert: function getOrInsert(key, value) {
14 if (has(aWeakMap(this), key)) return get(this, key);
15 set(this, key, value);
16 return value;
17 }
18});
Note: See TracBrowser for help on using the repository browser.