chore: extract monitor URL formatting to utils

This commit is contained in:
Deepanshu committed 2025-06-17 17:30:11 +05:30
1 parent e818f1cd61
commit f474d63e88
2 files changed
+10 -6

No files matched your search

+8
View File
@@ -5,3 +5,11 @@ export const safelyParseFloat = (value) => {
}
return parsedValue;
};
export const formatMonitorUrl = (url, maxLength = 50) => {
if (!url) return "";
const strippedUrl = url.replace(/^https?:\/\//, "");
return strippedUrl.length > maxLength
? `${strippedUrl.slice(0, maxLength)}…`
: strippedUrl;
};