valid-function.js 388 B

12345678910111213141516171819202122
  1. "use strict";
  2. module.exports = function (t, a) {
  3. var f = function () {};
  4. a(t(f), f, "Function");
  5. // eslint-disable-next-line no-new-func
  6. f = new Function();
  7. a(t(f), f, "Function");
  8. a.throws(function () {
  9. t({});
  10. }, "Object");
  11. a.throws(function () {
  12. t(/re/);
  13. }, "RegExp");
  14. a.throws(function () {
  15. t({
  16. call: function () {
  17. return 20;
  18. }
  19. });
  20. }, "Plain object");
  21. };