validate-stringifiable-value.js 520 B

12345678910111213141516171819202122
  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(t(0), "0");
  11. a(t(false), "false");
  12. a(t(""), "");
  13. a(t({}), String({}), "Object");
  14. a(t(x = function () {}), String(x), "Function");
  15. a(t(x = new String("raz")), String(x), "String object"); // Jslint: ignore
  16. a(t(x = new Date()), String(x), "Date");
  17. a.throws(function () {
  18. t(Object.create(null));
  19. }, TypeError, "Null prototype object");
  20. };