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.

toString.js 580B

12345678910111213141516171819202122232425262728
  1. var baseToString = require('./_baseToString');
  2. /**
  3. * Converts `value` to a string. An empty string is returned for `null`
  4. * and `undefined` values. The sign of `-0` is preserved.
  5. *
  6. * @static
  7. * @memberOf _
  8. * @since 4.0.0
  9. * @category Lang
  10. * @param {*} value The value to convert.
  11. * @returns {string} Returns the converted string.
  12. * @example
  13. *
  14. * _.toString(null);
  15. * // => ''
  16. *
  17. * _.toString(-0);
  18. * // => '-0'
  19. *
  20. * _.toString([1, 2, 3]);
  21. * // => '1,2,3'
  22. */
  23. function toString(value) {
  24. return value == null ? '' : baseToString(value);
  25. }
  26. module.exports = toString;