Fixes & refactor

This commit is contained in:
Andras Schmelczer 2025-02-22 17:17:07 +00:00
parent e6eedab87d
commit f73b5ecb71
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
4 changed files with 54 additions and 43 deletions

View file

@ -0,0 +1,13 @@
import { DocumentMetadata, RelativePath } from "src/persistence/database";
import { EMPTY_HASH } from "./hash";
export function findMatchingFileBasedOnHash(
contentHash: string,
candidates: [RelativePath, DocumentMetadata][]
): [RelativePath, DocumentMetadata] | undefined {
if (contentHash != EMPTY_HASH) {
return undefined;
}
return candidates.find(([_, document]) => document.hash === contentHash);
}