Export helper methods, add safe return to

This commit is contained in:
Alex Holliday committed 2024-11-05 13:31:10 +08:00
1 parent 2873f68868
commit 4ca3e3211f
1 file changed
+12 -1
+12 -1
View File
@@ -94,7 +94,8 @@ const getLatestResponseTime = (checks) => {
if (!checks || checks.length === 0) {
return 0;
}
return checks[0].responseTime;
return checks[0]?.responseTime ?? 0;
};
/**
@@ -586,3 +587,13 @@ export {
editMonitor,
addDemoMonitors,
};
// Helper functions
export {
calculateUptimeDuration,
getLastChecked,
getLatestResponseTime,
getAverageResponseTime,
getUptimePercentage,
getIncidents,
};