d0060dcfdc
Conditions can refer to the groups array that is a list of the preceding groups. This commit adds support to the verification for those conditions. This commit also adds some tests to the parsing and condition matching to ensure everything works as expected. PR Close #38164
25 lines
755 B
TypeScript
25 lines
755 B
TypeScript
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/
|
|
import {IMinimatch, Minimatch} from 'minimatch';
|
|
|
|
/** Map that holds patterns and their corresponding Minimatch globs. */
|
|
const patternCache = new Map<string, IMinimatch>();
|
|
|
|
/**
|
|
* Gets a glob for the given pattern. The cached glob will be returned
|
|
* if available. Otherwise a new glob will be created and cached.
|
|
*/
|
|
export function getOrCreateGlob(pattern: string) {
|
|
if (patternCache.has(pattern)) {
|
|
return patternCache.get(pattern)!;
|
|
}
|
|
const glob = new Minimatch(pattern, {dot: true});
|
|
patternCache.set(pattern, glob);
|
|
return glob;
|
|
}
|