Front end of the Slack clone application.

validate-object.js 714B

1234567891011121314151617181920212223242526272829303132333435
  1. "use strict";
  2. var iteratorSymbol = require("es6-symbol").iterator;
  3. module.exports = function (t, a) {
  4. var x;
  5. a.throws(function () {
  6. t(0);
  7. }, TypeError, "0");
  8. a.throws(function () {
  9. t(false);
  10. }, TypeError, "false");
  11. a.throws(function () {
  12. t("");
  13. }, TypeError, "String");
  14. a.throws(function () {
  15. t({});
  16. }, TypeError, "Plain Object");
  17. a.throws(function () {
  18. t(function () {});
  19. }, TypeError, "Function");
  20. a(t(x = new String("raz")), x, "String object"); // Jslint: ignore
  21. a(t(x = { length: 1 }), x, "Array like");
  22. a.throws(function () {
  23. t();
  24. }, TypeError, "Undefined");
  25. a.throws(function () {
  26. t(null);
  27. }, TypeError, "null");
  28. x = {};
  29. x[iteratorSymbol] = function () {};
  30. a(t(x), x, "Iterable");
  31. };