Renamed get to getById, map improvement

This commit is contained in:
2025-02-09 17:33:10 +01:00
parent 49dcd92a9e
commit a9cedba4e0
13 changed files with 44 additions and 26 deletions

View File

@ -7,7 +7,7 @@ export function uuidv4() {
}
export function unduplicateArray(array: any[]) {
const arrayToProcess = typeof array.flat === 'function' ? array.flat() : array;
const arrayToProcess = typeof array.flat === 'function' ? array.flat() : array
return [...new Set(arrayToProcess)]
}
@ -24,7 +24,7 @@ export async function downloadCache<T extends { id: string; updatedAt: Date }>(e
for (const item of items) {
let overwrite = false
const existingItem = await storage.get(item.id)
const existingItem = await storage.getById(item.id)
if (!existingItem || item.updatedAt > existingItem.updatedAt) {
overwrite = true