MCPcopy Create free account
hub / github.com/ternjs/tern / findMatchingPosition

Function findMatchingPosition

lib/tern.js:413–423  ·  view source on GitHub ↗
(line, file, near)

Source from the content-addressed store, hash-verified

411 }
412
413 function findMatchingPosition(line, file, near) {
414 var pos = Math.max(0, near - 500), closest = null;
415 if (!/^\s*$/.test(line)) for (;;) {
416 var found = file.indexOf(line, pos);
417 if (found < 0 || found > near + 500) break;
418 if (closest == null || Math.abs(closest - near) > Math.abs(found - near))
419 closest = found;
420 pos = found + line.length;
421 }
422 return closest;
423 }
424
425 function scopeDepth(s) {
426 for (var i = 0; s; ++i, s = s.prev) {}

Callers 1

resolveFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected