1 var Symbol = require('./_Symbol'),
2 arrayMap = require('./_arrayMap'),
3 isArray = require('./isArray'),
4 isSymbol = require('./isSymbol');
6 /** Used as references for various `Number` constants. */
9 /** Used to convert symbols to primitives and strings. */
10 var symbolProto = Symbol ? Symbol.prototype : undefined,
11 symbolToString = symbolProto ? symbolProto.toString : undefined;
14 * The base implementation of `_.toString` which doesn't convert nullish
15 * values to empty strings.
18 * @param {*} value The value to process.
19 * @returns {string} Returns the string.
21 function baseToString(value) {
22 // Exit early for strings to avoid a performance hit in some environments.
23 if (typeof value == 'string') {
27 // Recursively convert values (susceptible to call stack limits).
28 return arrayMap(value, baseToString) + '';
30 if (isSymbol(value)) {
31 return symbolToString ? symbolToString.call(value) : '';
33 var result = (value + '');
34 return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
37 module.exports = baseToString;