MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / parseTimeArgs

Function parseTimeArgs

cy/cy.ts:126–146  ·  view source on GitHub ↗
(parts: string[], fallbackLimit: number)

Source from the content-addressed store, hash-verified

124}
125
126function parseTimeArgs(parts: string[], fallbackLimit: number): { times: string[]; limit: number } | undefined {
127 const times: string[] = [];
128 let limit = fallbackLimit;
129 for (const part of parts) {
130 const values = part.split(",").map((item) => item.trim()).filter(Boolean);
131 if (!values.length) continue;
132 for (const value of values) {
133 if (isValidTime(value)) {
134 if (!times.includes(value)) times.push(value);
135 continue;
136 }
137 if (/^\d+$/.test(value)) {
138 limit = normalizeLimit(value, limit);
139 continue;
140 }
141 return undefined;
142 }
143 }
144 if (!times.length) return undefined;
145 return { times: times.slice(0, 12), limit };
146}
147
148function stablePeerPart(value: unknown): string {
149 const item: any = value as any;

Callers 1

CyPluginClass · 0.85

Calls 2

isValidTimeFunction · 0.85
normalizeLimitFunction · 0.85

Tested by

no test coverage detected