* @param {string} filepath - The filepath to check. * @returns {boolean} Should the given file be included?
(filepath)
| 37 | * @returns {boolean} Should the given file be included? |
| 38 | */ |
| 39 | isIncluded(filepath) { |
| 40 | let included = true; |
| 41 | |
| 42 | filepath = path.resolve(env.pwd, filepath); |
| 43 | |
| 44 | if ( this.includePattern && !this.includePattern.test(filepath) ) { |
| 45 | included = false; |
| 46 | } |
| 47 | |
| 48 | if ( this.excludePattern && this.excludePattern.test(filepath) ) { |
| 49 | included = false; |
| 50 | } |
| 51 | |
| 52 | if (this.exclude) { |
| 53 | this.exclude.forEach(exclude => { |
| 54 | if ( filepath.indexOf(exclude) === 0 ) { |
| 55 | included = false; |
| 56 | } |
| 57 | }); |
| 58 | } |
| 59 | |
| 60 | return included; |
| 61 | } |
| 62 | } |
| 63 | exports.Filter = Filter; |