validate-stringifiable-value.js 523 B

12345678910111213141516
  1. "use strict";
  2. module.exports = function (t, a) {
  3. var x;
  4. a.throws(function () { t(); }, TypeError, "Undefined");
  5. a.throws(function () { t(null); }, TypeError, "Null");
  6. a(t(0), "0");
  7. a(t(false), "false");
  8. a(t(""), "");
  9. a(t({}), String({}), "Object");
  10. a(t((x = function () {})), String(x), "Function");
  11. a(t((x = new String("raz"))), String(x), "String object"); // Jslint: ignore
  12. a(t((x = new Date())), String(x), "Date");
  13. a.throws(function () { t(Object.create(null)); }, TypeError, "Null prototype object");
  14. };