feat: add type checking for rawKey in formatKey function

This commit is contained in:
Sam Chau
2025-01-18 17:49:43 +10:30
parent 2621b3eea4
commit 3cba1472e6

View File

@@ -22,6 +22,12 @@ function formatSegment(segment) {
}
function formatKey(rawKey) {
// Add type checking
if (typeof rawKey !== 'string') {
console.warn('Expected string for key, received:', rawKey);
return String(rawKey || ''); // Convert to string or use empty string as fallback
}
const segments = rawKey.split('.');
const formattedSegments = segments.map(segment => formatSegment(segment));
return formattedSegments.join(': ');