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

Function createPatternMatcher

test/fixtures/snapshot/typescript.js:142410–142425  ·  view source on GitHub ↗
(pattern)

Source from the content-addressed store, hash-verified

142408 };
142409 }
142410 function createPatternMatcher(pattern) {
142411 // We'll often see the same candidate string many times when searching (For example, when
142412 // we see the name of a module that is used everywhere, or the name of an overload). As
142413 // such, we cache the information we compute about the candidate for the life of this
142414 // pattern matcher so we don't have to compute it multiple times.
142415 var stringToWordSpans = new ts.Map();
142416 var dotSeparatedSegments = pattern.trim().split(".").map(function (p) { return createSegment(p.trim()); });
142417 // A segment is considered invalid if we couldn't find any words in it.
142418 if (dotSeparatedSegments.some(function (segment) { return !segment.subWordTextChunks.length; }))
142419 return undefined;
142420 return {
142421 getFullMatch: function (containers, candidate) { return getFullMatch(containers, candidate, dotSeparatedSegments, stringToWordSpans); },
142422 getMatchForLastSegmentOfPattern: function (candidate) { return matchSegment(candidate, ts.last(dotSeparatedSegments), stringToWordSpans); },
142423 patternContainsDots: dotSeparatedSegments.length > 1
142424 };
142425 }
142426 ts.createPatternMatcher = createPatternMatcher;
142427 function getFullMatch(candidateContainers, candidate, dotSeparatedSegments, stringToWordSpans) {
142428 // First, check that the last part of the dot separated pattern matches the name of the

Callers

nothing calls this directly

Calls 7

createSegmentFunction · 0.85
getFullMatchFunction · 0.85
matchSegmentFunction · 0.85
someMethod · 0.80
mapMethod · 0.65
splitMethod · 0.45
lastMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…