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