MCPcopy Index your code
hub / github.com/nodejs/node / identicalSequenceRange

Function identicalSequenceRange

lib/internal/util/inspect.js:1611–1632  ·  view source on GitHub ↗
(a, b)

Source from the content-addressed store, hash-verified

1609}
1610
1611function identicalSequenceRange(a, b) {
1612 for (let i = 0; i < a.length - 3; i++) {
1613 // Find the first entry of b that matches the current entry of a.
1614 const pos = ArrayPrototypeIndexOf(b, a[i]);
1615 if (pos !== -1) {
1616 const rest = b.length - pos;
1617 if (rest > 3) {
1618 let len = 1;
1619 const maxLen = MathMin(a.length - i, rest);
1620 // Count the number of consecutive entries.
1621 while (maxLen > len && a[i + len] === b[pos + len]) {
1622 len++;
1623 }
1624 if (len > 3) {
1625 return [len, i];
1626 }
1627 }
1628 }
1629 }
1630
1631 return [0, 0];
1632}
1633
1634function getDuplicateErrorFrameRanges(frames) {
1635 // Build a map: frame line -> sorted list of indices where it occurs

Callers 2

enhanceStackTraceFunction · 0.85
getStackFramesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…