MCPcopy Index your code
hub / github.com/angular/angular / globListToMatcher

Function globListToMatcher

packages/service-worker/config/src/generator.ts:148–163  ·  view source on GitHub ↗
(globs: string[])

Source from the content-addressed store, hash-verified

146}
147
148function globListToMatcher(globs: string[]): (file: string) => boolean {
149 const patterns = globs.map((pattern) => {
150 if (pattern.startsWith('!')) {
151 return {
152 positive: false,
153 regex: new RegExp('^' + globToRegex(pattern.slice(1)) + '$'),
154 };
155 } else {
156 return {
157 positive: true,
158 regex: new RegExp('^' + globToRegex(pattern) + '$'),
159 };
160 }
161 });
162 return (file: string) => matches(file, patterns);
163}
164
165function matches(file: string, patterns: {positive: boolean; regex: RegExp}[]): boolean {
166 return patterns.reduce((isMatch, pattern) => {

Callers 1

processAssetGroupsMethod · 0.85

Calls 3

globToRegexFunction · 0.90
mapMethod · 0.80
matchesFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…