1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Refactor result comparison

Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
Lauri Nevala 2020-10-22 10:29:45 +03:00
parent 94411d5465
commit f73d87361a

View File

@ -23,9 +23,8 @@ export class DetectorRegistry {
const data = await detector.detect()
if (!data) continue;
const existingValue = results[detector.key]
if ((existingValue && existingValue.accuracy < data.accuracy) || !existingValue) { // previous value exists and is less accurate
results[detector.key] = data
}
if (existingValue && existingValue.accuracy > data.accuracy) continue; // previous value exists and is more accurate
results[detector.key] = data
} catch (e) {
// detector raised error, do nothing
}