MCPcopy Create free account
hub / github.com/nodejs/node / invalidDotDotAfterRecursiveWildcard

Function invalidDotDotAfterRecursiveWildcard

test/fixtures/snapshot/typescript.js:42085–42097  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

42083 }
42084 ts.isExcludedFile = isExcludedFile;
42085 function invalidDotDotAfterRecursiveWildcard(s) {
42086 // We used to use the regex /(^|\/)\*\*\/(.*\/)?\.\.($|\/)/ to check for this case, but
42087 // in v8, that has polynomial performance because the recursive wildcard match - **/ -
42088 // can be matched in many arbitrary positions when multiple are present, resulting
42089 // in bad backtracking (and we don't care which is matched - just that some /.. segment
42090 // comes after some **/ segment).
42091 var wildcardIndex = ts.startsWith(s, "**/") ? 0 : s.indexOf("/**/");
42092 if (wildcardIndex === -1) {
42093 return false;
42094 }
42095 var lastDotIndex = ts.endsWith(s, "/..") ? s.length : s.lastIndexOf("/../");
42096 return lastDotIndex > wildcardIndex;
42097 }
42098 /* @internal */
42099 function matchesExclude(pathToCheck, excludeSpecs, useCaseSensitiveFileNames, currentDirectory) {
42100 return matchesExcludeWorker(pathToCheck, ts.filter(excludeSpecs, function (spec) { return !invalidDotDotAfterRecursiveWildcard(spec); }), useCaseSensitiveFileNames, currentDirectory);

Callers 2

matchesExcludeFunction · 0.85
specToDiagnosticFunction · 0.85

Calls 1

indexOfMethod · 0.45

Tested by

no test coverage detected