( filePath: string, fingerprint: string, windowMs: number = DEFAULT_WINDOW_MS, now: () => number = Date.now, )
| 136 | } |
| 137 | |
| 138 | export function findRecent( |
| 139 | filePath: string, |
| 140 | fingerprint: string, |
| 141 | windowMs: number = DEFAULT_WINDOW_MS, |
| 142 | now: () => number = Date.now, |
| 143 | ): ReportedFingerprint | undefined { |
| 144 | const file = readReported(filePath); |
| 145 | const cutoff = now() - windowMs; |
| 146 | const match = file.entries |
| 147 | .filter((e) => e.fingerprint === fingerprint && e.ts >= cutoff) |
| 148 | .sort((a, b) => b.ts - a.ts)[0]; |
| 149 | return match; |
| 150 | } |
no test coverage detected