safe-to-string.js 266B

12345678910111213
  1. "use strict";
  2. var isCallable = require("./object/is-callable");
  3. module.exports = function (value) {
  4. try {
  5. if (value && isCallable(value.toString)) return value.toString();
  6. return String(value);
  7. } catch (e) {
  8. return "<Non-coercible to string value>";
  9. }
  10. };