to-short-string-representation.js 542 B

1234567891011121314151617181920212223
  1. "use strict";
  2. var repeat = require("../string/#/repeat");
  3. module.exports = function (t, a) {
  4. a(t(), "undefined");
  5. a(t(null), "null");
  6. a(t(10), "10");
  7. a(t("str"), "str");
  8. a(
  9. t({
  10. toString: function () {
  11. return "miszka";
  12. }
  13. }),
  14. "miszka"
  15. );
  16. // eslint-disable-next-line symbol-description
  17. if (typeof Symbol === "function") a(t(Symbol()), "Symbol()");
  18. a(t(Object.create(null)), "[Non-coercible (to string) value]");
  19. a(t(repeat.call("a", 300)), repeat.call("a", 99) + "…");
  20. a(t("mar\ntoo\nfar"), "mar\\ntoo\\nfar");
  21. };