es6.map.js 526 B

1234567891011121314151617
  1. 'use strict';
  2. var strong = require('./$.collection-strong');
  3. // 23.1 Map Objects
  4. require('./$.collection')('Map', function(get){
  5. return function Map(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
  6. }, {
  7. // 23.1.3.6 Map.prototype.get(key)
  8. get: function get(key){
  9. var entry = strong.getEntry(this, key);
  10. return entry && entry.v;
  11. },
  12. // 23.1.3.9 Map.prototype.set(key, value)
  13. set: function set(key, value){
  14. return strong.def(this, key === 0 ? 0 : key, value);
  15. }
  16. }, strong, true);