1
0

polyfill.js 684 B

12345678910111213141516171819202122
  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(map.has(y), true, "Has: pre clear");
  16. map.clear();
  17. a(map.has(y), false, "Has: after clear");
  18. };