MCPcopy Create free account
hub / github.com/VPSDance/ai-proxy-rules / parseClashYamlRules

Function parseClashYamlRules

scripts/sync/parsers.ts:84–96  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

82 }
83
84 return normalizeRuleSet(rules);
85}
86
87function parseClashYamlRules(text: string): RuleSet {
88 const parsed = parse(text) as unknown;
89
90 if (isPayloadObject(parsed)) {
91 return parseClassicalRules(parsed.payload.join("\n"));
92 }
93
94 if (Array.isArray(parsed) && parsed.every((item): item is string => typeof item === "string")) {
95 return parseClassicalRules(parsed.join("\n"));
96 }
97
98 throw new Error("Clash YAML source must contain a string payload list.");
99}

Callers 1

parseSourceRulesFunction · 0.85

Calls 2

isPayloadObjectFunction · 0.85
parseClassicalRulesFunction · 0.85

Tested by

no test coverage detected