MCPcopy Create free account
hub / github.com/Effect-TS/effect / matchPattern

Function matchPattern

packages/tools/api-diff/src/Discovery.ts:52–62  ·  view source on GitHub ↗
(pattern: string, value: string)

Source from the content-addressed store, hash-verified

50}
51
52const matchPattern = (pattern: string, value: string): string | undefined => {
53 const star = pattern.indexOf("*")
54 if (star === -1) {
55 return pattern === value ? "" : undefined
56 }
57 const prefix = pattern.slice(0, star)
58 const suffix = pattern.slice(star + 1)
59 return value.startsWith(prefix) && value.endsWith(suffix)
60 ? value.slice(prefix.length, value.length - suffix.length)
61 : undefined
62}
63
64export class Discovery extends Context.Service<Discovery, {
65 readonly discoverEntrypoints: (

Callers 1

DiscoveryClass · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected