wallet-core/node_modules/core-js/modules/es6.map.js

20 lines
642 B
JavaScript
Raw Normal View History

2016-10-10 03:43:44 +02:00
'use strict';
2017-05-27 17:36:13 +02:00
var strong = require('./_collection-strong');
2017-08-14 05:01:11 +02:00
var validate = require('./_validate-collection');
var MAP = 'Map';
2016-10-10 03:43:44 +02:00
// 23.1 Map Objects
2017-08-14 05:01:11 +02:00
module.exports = require('./_collection')(MAP, function (get) {
return function Map() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };
2016-10-10 03:43:44 +02:00
}, {
// 23.1.3.6 Map.prototype.get(key)
2017-08-14 05:01:11 +02:00
get: function get(key) {
var entry = strong.getEntry(validate(this, MAP), key);
2016-10-10 03:43:44 +02:00
return entry && entry.v;
},
// 23.1.3.9 Map.prototype.set(key, value)
2017-08-14 05:01:11 +02:00
set: function set(key, value) {
return strong.def(validate(this, MAP), key === 0 ? 0 : key, value);
2016-10-10 03:43:44 +02:00
}
2017-08-14 05:01:11 +02:00
}, strong, true);