* Stable identity for a marker: sha256 over file path, action, and normalized * marker text (trimmed, internal whitespace collapsed), truncated to 16 hex * chars. Line numbers are excluded so the hash survives line shifts.
(marker)
| 81 | * chars. Line numbers are excluded so the hash survives line shifts. |
| 82 | */ |
| 83 | function markerHash(marker) { |
| 84 | const normalizedText = String(marker.raw).trim().replace(/\s+/g, ' '); |
| 85 | return crypto |
| 86 | .createHash('sha256') |
| 87 | .update(marker.file + '\0' + marker.action + '\0' + normalizedText) |
| 88 | .digest('hex') |
| 89 | .slice(0, 16); |
| 90 | } |
| 91 | |
| 92 | /** Drop oldest-lastSeen entries until the map holds at most `max`. */ |
| 93 | function pruneByLastSeen(map, max) { |
no outgoing calls
no test coverage detected