Skip to content

Commit 44490c5

Browse files
committed
fixup! address comments
1 parent 72ebdcd commit 44490c5

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

lib/internal/util/inspect.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,7 +1347,7 @@ function getDuplicateErrorFrameRanges(frames) {
13471347
}
13481348

13491349
// Theoretical maximum range, adjusted while iterating
1350-
let range = positions.at(-1) - i;
1350+
let range = positions[positions.length - 1] - i;
13511351
if (range < minimumDuplicateRange) {
13521352
continue;
13531353
}
@@ -1414,7 +1414,7 @@ function getDuplicateErrorFrameRanges(frames) {
14141414
}
14151415

14161416
if (duplicateRanges * range >= 3) {
1417-
result.push([i + range, range, duplicateRanges]);
1417+
result.push(i + range, range, duplicateRanges);
14181418
// Skip over the collapsed portion to avoid overlapping matches.
14191419
i += range * (duplicateRanges + 1) - 1;
14201420
}
@@ -1467,8 +1467,11 @@ function getStackFrames(ctx, err, stack) {
14671467
if (frames.length > 10) {
14681468
const ranges = getDuplicateErrorFrameRanges(frames);
14691469

1470-
while (ranges.length) {
1471-
const { 0: offset, 1: length, 2: duplicateRanges } = ranges.pop();
1470+
for (let i = 0; i < ranges.length; i += 3) {
1471+
const offset = ranges[i];
1472+
const length = ranges[i + 1];
1473+
const duplicateRanges = ranges[i + 2];
1474+
14721475
const msg = ` ... collapsed ${length * duplicateRanges} duplicate lines ` +
14731476
'matching above ' +
14741477
(duplicateRanges > 1 ?

0 commit comments

Comments
 (0)