MCPcopy Create free account
hub / github.com/claude-code-best/claude-code / isValidState

Function isValidState

src/utils/cacheStats.ts:67–76  ·  view source on GitHub ↗
(obj: unknown)

Source from the content-addressed store, hash-verified

65}
66
67function isValidState(obj: unknown): obj is CacheStatsState {
68 if (typeof obj !== 'object' || obj === null) return false
69 const s = obj as Record<string, unknown>
70 return (
71 s['version'] === 1 &&
72 (s['signature'] === null || typeof s['signature'] === 'string') &&
73 (s['lastResetAt'] === null || typeof s['lastResetAt'] === 'number') &&
74 (s['lastHitRate'] === null || typeof s['lastHitRate'] === 'number')
75 )
76}
77
78/**
79 * Read state file. Returns init defaults on any error (corrupt, missing, etc.).

Callers 1

readStateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected