(parts: string[], fallbackLimit: number)
| 124 | } |
| 125 | |
| 126 | function 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 | |
| 148 | function stablePeerPart(value: unknown): string { |
| 149 | const item: any = value as any; |
no test coverage detected