You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

safe-to-string.js 266B

123456789101112
  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. };