MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / getModeId

Function getModeId

src/cm/supportedModes.ts:46–54  ·  view source on GitHub ↗
(name: string, aliases: string[])

Source from the content-addressed store, hash-verified

44}
45
46function getModeId(name: string, aliases: string[]): string {
47 const normalizedName = normalizeModeKey(name);
48 if (isSafeModeId(normalizedName)) return normalizedName;
49
50 const safeAlias = aliases.find(
51 (alias) => alias !== normalizedName && isSafeModeId(alias),
52 );
53 return safeAlias || slugifyModeId(name) || normalizedName || "text";
54}
55
56function escapeRegExp(value: string): string {
57 return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");

Callers 1

supportedModes.tsFile · 0.85

Calls 3

isSafeModeIdFunction · 0.85
slugifyModeIdFunction · 0.85
normalizeModeKeyFunction · 0.70

Tested by

no test coverage detected