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

Callers 1

CyPluginClass · 0.85

Calls 2

isValidTimeFunction · 0.85
normalizeLimitFunction · 0.85

Tested by

no test coverage detected