(raw: Record<string, unknown>)
| 126 | } |
| 127 | |
| 128 | function resetHintFrom(raw: Record<string, unknown>): string | undefined { |
| 129 | for (const key of ['reset_at', 'resetAt', 'reset_time', 'resetTime']) { |
| 130 | const v = raw[key]; |
| 131 | if (typeof v === 'string' && v.length > 0) { |
| 132 | return formatResetTime(v); |
| 133 | } |
| 134 | } |
| 135 | for (const key of ['reset_in', 'resetIn', 'ttl', 'window']) { |
| 136 | const seconds = toInt(raw[key]); |
| 137 | if (seconds !== null && seconds > 0) { |
| 138 | return `resets in ${formatDuration(seconds)}`; |
| 139 | } |
| 140 | } |
| 141 | return undefined; |
| 142 | } |
| 143 | |
| 144 | export function formatResetTime(val: string): string { |
| 145 | let normalised = val; |
no test coverage detected