Files
Checkmate/client/src/Utils/utils.js
T

15 lines
390 B
JavaScript
Raw Normal View History

2025-02-26 11:41:36 -08:00
export const safelyParseFloat = (value) => {
const parsedValue = parseFloat(value);
if (isNaN(parsedValue)) {
return 0;
}
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;
};