You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

valid-weak-map.js 626B

1234567891011121314151617181920212223242526272829303132
  1. "use strict";
  2. var WeakMapPoly = require("../polyfill");
  3. module.exports = function (t, a) {
  4. var map;
  5. a.throws(function () {
  6. t(undefined);
  7. }, TypeError, "Undefined");
  8. a.throws(function () {
  9. t(null);
  10. }, TypeError, "Null");
  11. a.throws(function () {
  12. t(true);
  13. }, TypeError, "Primitive");
  14. a.throws(function () {
  15. t("raz");
  16. }, TypeError, "String");
  17. a.throws(function () {
  18. t({});
  19. }, TypeError, "Object");
  20. a.throws(function () {
  21. t([]);
  22. }, TypeError, "Array");
  23. if (typeof WeakMap !== "undefined") {
  24. map = new WeakMap();
  25. a(t(map), map, "Native");
  26. }
  27. map = new WeakMapPoly();
  28. a(t(map), map, "Polyfill");
  29. };