valid-object.js 512 B

12345678910111213141516171819202122232425
  1. "use strict";
  2. module.exports = function (t, a) {
  3. var x;
  4. a.throws(function () {
  5. t(0);
  6. }, TypeError, "0");
  7. a.throws(function () {
  8. t(false);
  9. }, TypeError, "false");
  10. a.throws(function () {
  11. t("");
  12. }, TypeError, "''");
  13. a(t(x = {}), x, "Object");
  14. a(t(x = function () {}), x, "Function");
  15. a(t(x = new String("raz")), x, "String object"); // Jslint: ignore
  16. a(t(x = new Date()), x, "Date");
  17. a.throws(function () {
  18. t();
  19. }, TypeError, "Undefined");
  20. a.throws(function () {
  21. t(null);
  22. }, TypeError, "null");
  23. };