valid-set.js 591 B

12345678910111213141516171819
  1. 'use strict';
  2. var SetPoly = require('../polyfill');
  3. module.exports = function (t, a) {
  4. var set;
  5. a.throws(function () { t(undefined); }, TypeError, "Undefined");
  6. a.throws(function () { t(null); }, TypeError, "Null");
  7. a.throws(function () { t(true); }, TypeError, "Primitive");
  8. a.throws(function () { t('raz'); }, TypeError, "String");
  9. a.throws(function () { t({}); }, TypeError, "Object");
  10. a.throws(function () { t([]); }, TypeError, "Array");
  11. if (typeof Set !== 'undefined') {
  12. set = new Set();
  13. a(t(set), set, "Native");
  14. }
  15. set = new SetPoly();
  16. a(t(set), set, "Polyfill");
  17. };