From 8cbf42384f293682302b3bb8ed7464d29fb8e510 Mon Sep 17 00:00:00 2001 From: mshanemc Date: Fri, 24 May 2024 14:34:59 -0500 Subject: [PATCH] docs: todo about set intersection --- src/shared/local/moveDetection.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/shared/local/moveDetection.ts b/src/shared/local/moveDetection.ts index b6d84842..a2a58d15 100644 --- a/src/shared/local/moveDetection.ts +++ b/src/shared/local/moveDetection.ts @@ -62,6 +62,7 @@ export const getMatches = (status: StatusRow[]): AddedAndDeletedFilenames => { const addedBasenames = new Set(addedFilenames.map((filename) => path.basename(filename))); const deletedBasenames = new Set(deletedFilenames.map((filename) => path.basename(filename))); + // TODO: when node 22 is everywhere, we can use Set.prototype.intersection // Again, we filter over the deleted files first and exit early if there are no filename matches const deletedFilenamesWithMatches = new Set(deletedFilenames.filter((f) => addedBasenames.has(path.basename(f)))); if (!deletedFilenamesWithMatches.size) return emptyResult;