diff options
author | sigmaSd <bedisnbiba@gmail.com> | 2022-10-10 15:22:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-10 10:22:21 -0400 |
commit | 70ad6717dfd1af57693e48e99a2f2e05f05c14eb (patch) | |
tree | ae42a7208ff0986d37270612d80e115cfd4e9618 /ext | |
parent | 1ab3691b091e34ffa5a0b8f2cd18a87da8c4930c (diff) |
fix sparse array inspection (#16204)
fix https://github.com/denoland/deno/issues/16202
Diffstat (limited to 'ext')
-rw-r--r-- | ext/console/02_console.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ext/console/02_console.js b/ext/console/02_console.js index efb7aeb50..7554a88fc 100644 --- a/ext/console/02_console.js +++ b/ext/console/02_console.js @@ -417,6 +417,7 @@ } } + let entriesLengthWithoutEmptyItems = entriesLength; if (options.typeName === "Array") { for ( let i = 0, j = 0; @@ -433,7 +434,7 @@ if (skipTo) { // subtract skipped (empty) items - entriesLength -= skipTo - i; + entriesLengthWithoutEmptyItems -= skipTo - i; i = skipTo; } } @@ -478,8 +479,9 @@ ArrayPrototypeSort(entries); } - if (entriesLength > inspectOptions.iterableLimit) { - const nmore = entriesLength - inspectOptions.iterableLimit; + if (entriesLengthWithoutEmptyItems > inspectOptions.iterableLimit) { + const nmore = entriesLengthWithoutEmptyItems - + inspectOptions.iterableLimit; ArrayPrototypePush(entries, `... ${nmore} more items`); } |