Fixes & refactor
This commit is contained in:
parent
e6eedab87d
commit
f73b5ecb71
4 changed files with 54 additions and 43 deletions
|
|
@ -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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue