MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / resetHintFrom

Function resetHintFrom

packages/oauth/src/managed-usage.ts:128–142  ·  view source on GitHub ↗
(raw: Record<string, unknown>)

Source from the content-addressed store, hash-verified

126}
127
128function 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
144export function formatResetTime(val: string): string {
145 let normalised = val;

Callers 1

toUsageRowFunction · 0.85

Calls 3

formatResetTimeFunction · 0.85
toIntFunction · 0.85
formatDurationFunction · 0.70

Tested by

no test coverage detected