( exclude: Array<PluginFilter> | undefined, include: Array<PluginFilter> | undefined, )
| 66 | } |
| 67 | |
| 68 | function createFilter( |
| 69 | exclude: Array<PluginFilter> | undefined, |
| 70 | include: Array<PluginFilter> | undefined, |
| 71 | ): PluginFilter | undefined { |
| 72 | if (!exclude && !include) { |
| 73 | return |
| 74 | } |
| 75 | |
| 76 | return (input) => { |
| 77 | if (exclude?.some((filter) => filter(input))) { |
| 78 | return false |
| 79 | } |
| 80 | if (include?.some((filter) => filter(input))) { |
| 81 | return true |
| 82 | } |
| 83 | return !(include && include.length > 0) |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | function normalizeFilter(filter: StringFilter): NormalizedStringFilter { |
| 88 | if (typeof filter === 'string' || filter instanceof RegExp) { |
no test coverage detected