Preserve sign of 0 in _.toString.

This commit is contained in:
Xotic750
2015-10-28 01:04:31 +01:00
committed by John-David Dalton
parent 9c342eb432
commit cd371ac66f
2 changed files with 42 additions and 37 deletions

View File

@@ -9760,6 +9760,10 @@
* @returns {string} Returns the string.
*/
function toString(value) {
// Preserve sign of `0`.
if (value === 0) {
return (1 / value) == INFINITY ? '0' : '-0';
}
// Exit early for strings to avoid a performance hit in some environments.
if (typeof value == 'string') {
return value;