safe-to-string.js 394 B

12345678910111213141516171819
  1. "use strict";
  2. module.exports = function (t, a) {
  3. a(t(), "undefined");
  4. a(t(null), "null");
  5. a(t(10), "10");
  6. a(t("str"), "str");
  7. a(
  8. t({
  9. toString: function () {
  10. return "miszka";
  11. }
  12. }),
  13. "miszka"
  14. );
  15. // eslint-disable-next-line symbol-description
  16. if (typeof Symbol === "function") a(t(Symbol()), "Symbol()");
  17. a(t(Object.create(null)), "[Non-coercible (to string) value]");
  18. };