JAVASCRIPT   169

valid-array.js

Guest on 9th September 2021 04:44:39 PM

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

Raw Paste


Login or Register to edit or fork this paste. It's free.