( nodeMatchers: Partial<Record<ScopeType, NodeMatcherAlternative>> )
| 161 | }; |
| 162 | |
| 163 | export function createPatternMatchers( |
| 164 | nodeMatchers: Partial<Record<ScopeType, NodeMatcherAlternative>> |
| 165 | ): Record<ScopeType, NodeMatcher> { |
| 166 | Object.keys(nodeMatchers).forEach((scopeType: ScopeType) => { |
| 167 | let matcher = nodeMatchers[scopeType]; |
| 168 | if (Array.isArray(matcher)) { |
| 169 | nodeMatchers[scopeType] = patternMatcher(...matcher); |
| 170 | } else if (typeof matcher === "string") { |
| 171 | nodeMatchers[scopeType] = patternMatcher(matcher); |
| 172 | } |
| 173 | }); |
| 174 | return nodeMatchers as Record<ScopeType, NodeMatcher>; |
| 175 | } |
no test coverage detected