MCPcopy Create free account
hub / github.com/scriptscat/scriptcat / globSplit

Function globSplit

src/pkg/utils/url_matcher.ts:59–69  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

57};
58
59const globSplit = (text: string): string[] => {
60 const split = text.split(/([*?]{2,})/g);
61 for (let i = 1; i < split.length; i += 2) {
62 // "*????" 改成 "????*",避免 backward 处理
63 // api定义的 glob * 是等价于 glob **
64 const p = split[i]; // **??**??**
65 const q = p.replace(/\*/g, ""); // ????
66 if (p !== q) split[i] = `${q}*`; // ????*
67 }
68 return split.join("").split(/([*?])/g);
69};
70
71export const extractUrlPatterns = (lines: string[]): URLRuleEntry[] => {
72 const rules = [];

Callers 1

extractUrlPatternsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected