valid-array.js 579 B

123456789101112131415161718192021222324252627282930
  1. "use strict";
  2. module.exports = function (t, a) {
  3. var x;
  4. a.throws(function () {
  5. t();
  6. }, TypeError, "Undefined");
  7. a.throws(function () {
  8. t(null);
  9. }, TypeError, "Null");
  10. a.throws(function () {
  11. t(0);
  12. }, TypeError, "Number");
  13. a.throws(function () {
  14. t(true);
  15. }, TypeError, "Boolean");
  16. a.throws(function () {
  17. t("raz");
  18. }, TypeError, "String");
  19. a.throws(function () {
  20. t(function () {});
  21. }, TypeError, "Function");
  22. a.throws(function () {
  23. t({});
  24. }, TypeError, "Object");
  25. a.throws(function () {
  26. t({ length: 0 });
  27. }, TypeError, "Array-like");
  28. a(t(x = []), x, "Array");
  29. };