mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
19 lines
588 B
TypeScript
19 lines
588 B
TypeScript
|
|
/**
|
||
|
|
* @license
|
||
|
|
* Copyright Google Inc. 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
|
||
|
|
*/
|
||
|
|
|
||
|
|
export function filterFileByPatterns(
|
||
|
|
fileName: string, options: {includeFilePattern?: RegExp, excludeFilePattern?: RegExp} = {}) {
|
||
|
|
let match = true;
|
||
|
|
if (options.includeFilePattern) {
|
||
|
|
match = match && !!options.includeFilePattern.exec(fileName);
|
||
|
|
}
|
||
|
|
if (options.excludeFilePattern) {
|
||
|
|
match = match && !options.excludeFilePattern.exec(fileName);
|
||
|
|
}
|
||
|
|
return match;
|
||
|
|
}
|