diff options
Diffstat (limited to 'lib/util.js')
-rw-r--r-- | lib/util.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/util.js b/lib/util.js index 27affda109..2e42beb58b 100644 --- a/lib/util.js +++ b/lib/util.js @@ -102,7 +102,13 @@ function formatWithOptions(inspectOptions, f) { tempStr = tryStringify(arguments[a++]); break; case 100: // 'd' - tempStr = `${Number(arguments[a++])}`; + const tempNum = arguments[a++]; + // eslint-disable-next-line valid-typeof + if (typeof tempNum === 'bigint') { + tempStr = `${tempNum}n`; + } else { + tempStr = `${Number(tempNum)}`; + } break; case 79: // 'O' tempStr = inspect(arguments[a++], inspectOptions); @@ -117,7 +123,13 @@ function formatWithOptions(inspectOptions, f) { break; } case 105: // 'i' - tempStr = `${parseInt(arguments[a++])}`; + const tempInteger = arguments[a++]; + // eslint-disable-next-line valid-typeof + if (typeof tempInteger === 'bigint') { + tempStr = `${tempInteger}n`; + } else { + tempStr = `${parseInt(tempInteger)}`; + } break; case 102: // 'f' tempStr = `${parseFloat(arguments[a++])}`; |