diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2018-08-12 23:35:27 +0200 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-08-15 17:52:36 +0200 |
commit | db6a24699abce1eba6760c2c3e31b390ab684410 (patch) | |
tree | 6e707a17dec8bcc69ec6a9d060d6c2489ca7635a /lib/util.js | |
parent | d164d9d606af4061be1a198e2b3e91973464d40c (diff) | |
download | android-node-v8-db6a24699abce1eba6760c2c3e31b390ab684410.tar.gz android-node-v8-db6a24699abce1eba6760c2c3e31b390ab684410.tar.bz2 android-node-v8-db6a24699abce1eba6760c2c3e31b390ab684410.zip |
util: improve empty typed array inspection
They should be aligned with all other empty objects. Therefore the
whitespace is removed and they got a fast path for that.
PR-URL: https://github.com/nodejs/node/pull/22284
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Diffstat (limited to 'lib/util.js')
-rw-r--r-- | lib/util.js | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/util.js b/lib/util.js index 793aa3ca16..88a753409c 100644 --- a/lib/util.js +++ b/lib/util.js @@ -666,6 +666,8 @@ function formatValue(ctx, value, recurseTimes) { formatter = formatMap; } else if (isTypedArray(value)) { braces = [`${getPrefix(constructor, tag)}[`, ']']; + if (value.length === 0 && keyLength === 0 && !ctx.showHidden) + return `${braces[0]}]`; formatter = formatTypedArray; } else if (isMapIterator(value)) { braces = [`[${tag}] {`, '}']; |