MCPcopy Index your code
hub / github.com/TanStack/devtools / matcher

Function matcher

packages/devtools-vite/src/matcher.ts:3–19  ·  view source on GitHub ↗
(
  patterns: Array<string | RegExp>,
  str: string,
)

Source from the content-addressed store, hash-verified

1import picomatch from 'picomatch'
2
3export const matcher = (
4 patterns: Array<string | RegExp>,
5 str: string,
6): boolean => {
7 if (patterns.length === 0) {
8 return false
9 }
10 const matchers = patterns.map((pattern) => {
11 if (typeof pattern === 'string') {
12 return picomatch(pattern)
13 } else {
14 return (s: string) => pattern.test(s)
15 }
16 })
17
18 return matchers.some((isMatch) => isMatch(str))
19}

Callers 3

matcher.test.tsFile · 0.90
shouldTransformFunction · 0.90
addSourceToJsxFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected