Skip to content

Commit

Permalink
fix: display "-0" for -0 (#2281)
Browse files Browse the repository at this point in the history
Added special handling code in js/console.ts
  • Loading branch information
kevinkassimo authored and ry committed May 3, 2019
1 parent 5283041 commit 6929aba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions js/console.ts
Expand Up @@ -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":
Expand Down
1 change: 1 addition & 0 deletions js/console_test.ts
Expand Up @@ -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");
Expand Down

0 comments on commit 6929aba

Please sign in to comment.