mirror of
https://github.com/denoland/deno.git
synced 2024-11-22 15:06:54 -05:00
fix: display "-0" for -0 (#2281)
Added special handling code in js/console.ts
This commit is contained in:
parent
52830414da
commit
6929aba71d
2 changed files with 3 additions and 0 deletions
|
@ -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":
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue