1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-24 15:19:26 -05:00

feat: Support for bigints in console

This commit is contained in:
kyraNET 2018-12-01 01:59:41 +01:00 committed by Ryan Dahl
parent a05d9aaead
commit 7c6479e28f
2 changed files with 3 additions and 0 deletions

View file

@ -105,6 +105,8 @@ function stringify(
case "undefined":
case "symbol":
return String(value);
case "bigint":
return `${value}n`;
case "function":
return createFunctionString(value as Function, ctx);
case "object":

View file

@ -70,6 +70,7 @@ test(function consoleTestStringifyCircular() {
const nestedObjExpected = `{ num: 1, bool: true, str: "a", method: [Function: method], asyncMethod: [AsyncFunction: asyncMethod], generatorMethod: [GeneratorFunction: generatorMethod], un: undefined, nu: null, arrowFunc: [Function: arrowFunc], extendedClass: Extended { a: 1, b: 2 }, nFunc: [Function], extendedCstr: [Function: Extended], o: { num: 2, bool: false, str: "b", method: [Function: method], un: undefined, nu: null, nested: [Circular], emptyObj: [object], arr: [object], baseClass: [object] } }`;
assertEqual(stringify(1), "1");
assertEqual(stringify(1n), "1n");
assertEqual(stringify("s"), "s");
assertEqual(stringify(false), "false");
assertEqual(stringify(Symbol(1)), "Symbol(1)");