polyfill.js 677 B

1234567891011121314151617181920212223
  1. 'use strict';
  2. module.exports = function (T, a) {
  3. var x = {}, y = {}, z = {}, arr = [[x, 'raz'], [y, 'dwa']], map = new T(arr);
  4. a(map instanceof T, true, "WeakMap");
  5. a(map.has(x), true, "Has: true");
  6. a(map.get(x), 'raz', "Get: contains");
  7. a(map.has(z), false, "Has: false");
  8. a(map.get(z), undefined, "Get: doesn't contain");
  9. a(map.set(z, 'trzy'), map, "Set: return");
  10. a(map.has(z), true, "Add");
  11. a(map.delete({}), false, "Delete: false");
  12. a(map.delete(x), true, "Delete: true");
  13. a(map.get(x), undefined, "Get: after delete");
  14. a(map.has(x), false, "Has: after delete");
  15. a.h1("Empty initialization");
  16. map = new T();
  17. map.set(x, 'bar');
  18. a(map.get(x), 'bar');
  19. };