mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 01:57:50 +00:00
Preserve sign of 0 in _.toString.
This commit is contained in:
committed by
John-David Dalton
parent
9c342eb432
commit
cd371ac66f
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user