fix: cache for descript.ion files was not effective

Massimo Melina committed Oct 20, 2023 at 11:49 UTC 9cda08154804fe7bbab555d6d9c6f59ee05fe493
1 file changed +1 -1
src/util-files.ts
+1 -1
@@ -174,7 +174,7 @@ const cache = new Map<string, { ts: Date, parsed: unknown }>()
174 export async function parseFile<T>(path: string, parse: (raw: string) => T) {
175 const { mtime: ts } = await stat(path)
176 const cached = cache.get(path)
177 - if (ts === cached?.ts)
177 + if (cached && Number(ts) === Number(cached.ts))
178 return cached.parsed as T
179 const raw = await readFile(path, 'utf8')
180 const parsed = parse(raw)