to-short-string-representation.js 521 B

12345678910111213141516
  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(t({ toString: function () { return "miszka"; } }), "miszka");
  9. // eslint-disable-next-line symbol-description
  10. if (typeof Symbol === "function") a(t(Symbol()), "Symbol()");
  11. a(t(Object.create(null)), "<Non-coercible to string value>");
  12. a(t(repeat.call("a", 300)), repeat.call("a", 99) + "…");
  13. a(t("mar\ntoo\nfar"), "mar\\ntoo\\nfar");
  14. };