chore: extract monitor URL formatting to utils
This commit is contained in:
1 parent
e818f1cd61
commit
f474d63e88
2 files changed
+10
-6
No files matched your search
@@ -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;
|
||||
};
|
||||
Reference in new issue
Block a user