1 var Symbol = require('./_Symbol'),
2 isSymbol = require('./isSymbol');
4 /** Used as references for various `Number` constants. */
7 /** Used to convert symbols to primitives and strings. */
8 var symbolProto = Symbol ? Symbol.prototype : undefined,
9 symbolToString = Symbol ? symbolProto.toString : undefined;
12 * Converts `value` to a string if it's not one. An empty string is returned
13 * for `null` and `undefined` values. The sign of `-0` is preserved.
18 * @param {*} value The value to process.
19 * @returns {string} Returns the string.
28 * _.toString([1, 2, 3]);
31 function toString(value) {
32 // Exit early for strings to avoid a performance hit in some environments.
33 if (typeof value == 'string') {
39 if (isSymbol(value)) {
40 return Symbol ? symbolToString.call(value) : '';
42 var result = (value + '');
43 return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
46 module.exports = toString;