diff options
author | Kevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com> | 2019-05-03 11:01:20 -0700 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-05-03 14:01:20 -0400 |
commit | 6929aba71d5004f9d2ff1d6c2e6817b6dfb22c89 (patch) | |
tree | 98d7a0db36a03c456997a167cd5dca5375e0a844 /js | |
parent | 52830414daa40b19ed8e06182bb2ea68cfd316af (diff) |
fix: display "-0" for -0 (#2281)
Added special handling code in js/console.ts
Diffstat (limited to 'js')
-rw-r--r-- | js/console.ts | 2 | ||||
-rw-r--r-- | js/console_test.ts | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/js/console.ts b/js/console.ts index 169ff83fb..9b38e1b49 100644 --- a/js/console.ts +++ b/js/console.ts @@ -122,6 +122,8 @@ function stringify( case "string": return value; case "number": + // Special handling of -0 + return Object.is(value, -0) ? "-0" : `${value}`; case "boolean": case "undefined": case "symbol": diff --git a/js/console_test.ts b/js/console_test.ts index 32e2c5ae2..e7cc360bc 100644 --- a/js/console_test.ts +++ b/js/console_test.ts @@ -100,6 +100,7 @@ test(function consoleTestStringifyCircular(): void { const nestedObjExpected = `{ num, bool, str, method, asyncMethod, generatorMethod, un, nu, arrowFunc, extendedClass, nFunc, extendedCstr, o }`; assertEquals(stringify(1), "1"); + assertEquals(stringify(-0), "-0"); assertEquals(stringify(1n), "1n"); assertEquals(stringify("s"), "s"); assertEquals(stringify(false), "false"); |