1 | import path from 'path';
|
2 | import minimatch from 'minimatch';
|
3 | import { normalizeFileName } from '@stryker-mutator/util';
|
4 |
|
5 |
|
6 |
|
7 | export class FileMatcher {
|
8 | constructor(pattern) {
|
9 | if (typeof pattern === 'string') {
|
10 | this.pattern = normalizeFileName(path.resolve(pattern));
|
11 | }
|
12 | else {
|
13 | this.pattern = pattern;
|
14 | }
|
15 | }
|
16 | matches(fileName) {
|
17 | if (typeof this.pattern === 'string') {
|
18 | return minimatch(normalizeFileName(path.resolve(fileName)), this.pattern);
|
19 | }
|
20 | else {
|
21 | return this.pattern;
|
22 | }
|
23 | }
|
24 | }
|
25 |
|
\ | No newline at end of file |