bitcoin-inscription-viewer
Version:
🔍 A robust, production-ready React/TypeScript library for viewing Bitcoin Ordinals inscriptions with advanced optimization features including LRU caching, LaserEyes wallet integration, virtual scrolling, and performance monitoring
45 lines • 1.84 kB
TypeScript
/**
* Safe formatting utilities to prevent runtime errors
*/
/**
* Safely extracts and formats the subtype from a MIME type
* @param mimeType - The MIME type string (e.g., "image/png", "video/mp4")
* @param fallback - Fallback value if parsing fails
* @returns Formatted subtype in uppercase
*/
export declare function safeMimeSubtype(mimeType: string | undefined | null, fallback?: string): string;
/**
* Safely formats a file extension to uppercase
* @param extension - The file extension (with or without dot)
* @param fallback - Fallback value if extension is invalid
* @returns Formatted extension in uppercase
*/
export declare function safeExtensionFormat(extension: string | undefined | null, fallback?: string): string;
/**
* Gets a display-friendly format label from MIME type and/or extension
* @param mimeType - The MIME type string
* @param fileExtension - The file extension
* @param fallback - Fallback value if both are invalid
* @returns Formatted display label
*/
export declare function getFormatLabel(mimeType?: string | null, fileExtension?: string | null, fallback?: string): string;
/**
* Safely converts any value to uppercase string
* @param value - The value to convert
* @param fallback - Fallback value if conversion fails
* @returns Uppercase string
*/
export declare function safeToUpperCase(value: unknown, fallback?: string): string;
/**
* Formats time duration safely
* @param seconds - Duration in seconds
* @returns Formatted time string (MM:SS or HH:MM:SS)
*/
export declare function safeFormatTime(seconds: number | undefined | null): string;
/**
* Safely formats file size
* @param bytes - Size in bytes
* @returns Formatted size string
*/
export declare function safeFormatFileSize(bytes: number | undefined | null): string;
//# sourceMappingURL=safeFormatting.d.ts.map