valid-reg-exp.js 339 B

123456789101112131415
  1. "use strict";
  2. module.exports = function (t, a) {
  3. var r = /raz/;
  4. a(t(r), r, "Direct");
  5. r = new RegExp("foo");
  6. a(t(r), r, "Constructor");
  7. a.throws(function () { t({}); }, "Object");
  8. a.throws(function () {
  9. t(function () {});
  10. }, "Function");
  11. a.throws(function () {
  12. t({ exec: function () { return 20; } });
  13. }, "Plain object");
  14. };