src/utils/monitoring/dataValidation
Utility functions for parsing and validating monitoring data with safe error handling.
Remarksโ
Provides safe parsing functions with comprehensive validation and error handling for monitoring-related data. These utilities ensure that invalid input data doesn't crash the app and provides meaningful fallback values.
Key features:
- Safe uptime string parsing with validation
- Input sanitization and range validation
- Comprehensive error logging for debugging
- Fallback values for invalid inputs
Exampleโ
import { parseUptimeValue } from "./dataValidation";
// Parse uptime strings safely
const uptime1 = parseUptimeValue("99.5%"); // Returns: 99.5
const uptime2 = parseUptimeValue("invalid"); // Returns: 0 (fallback)