value-to-string.js 370 B

1234567891011121314151617
  1. "use strict";
  2. /**
  3. * Returns a string representation of the value
  4. *
  5. * @param {*} value
  6. * @returns {string}
  7. */
  8. function valueToString(value) {
  9. if (value && value.toString) {
  10. // eslint-disable-next-line @sinonjs/no-prototype-methods/no-prototype-methods
  11. return value.toString();
  12. }
  13. return String(value);
  14. }
  15. module.exports = valueToString;