valid-reg-exp.js 342 B

1234567891011121314151617
  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 () {
  8. t({});
  9. }, "Object");
  10. a.throws(function () {
  11. t(function () {});
  12. }, "Function");
  13. a.throws(function () {
  14. t({ exec: function () { return 20; } });
  15. }, "Plain object");
  16. };