Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 51x 51x 51x 51x 51x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 961x 961x 961x 961x 961x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 20x 20x 20x 1x 1x 1x 1x 1x 1x 1x 1x 1x 23x 23x 23x 23x 23x 23x | /**
* Number formatting utilities
* All number displays in the application should use these helpers for consistency
*/
/**
* Formats a number with commas as thousand separators
* @param value - The number to format
* @param decimals - Number of decimal places (default: 0)
* @returns Formatted number string
* @example
* formatNumber(1234.56) // "1,234"
* formatNumber(1234.56, 2) // "1,234.56"
*/
export function formatNumber(value: number, decimals: number = 0): string {
return value.toLocaleString('en-US', {
minimumFractionDigits: decimals,
maximumFractionDigits: decimals});
}
/**
* Formats a number as currency
* @param value - The amount to format
* @param currency - Currency code (default: 'USD')
* @returns Formatted currency string
* @example
* formatCurrency(1234.56) // "$1,234.56"
* formatCurrency(1000, 'EUR') // "€1,000.00"
*/
export function formatCurrency(value: number, currency: string = 'USD'): string {
return new Intl.NumberFormat('en-US', {
style: 'currency',
currency}).format(value);
}
/**
* Formats a number as a percentage
* @param value - The decimal value (0.15 = 15%)
* @param decimals - Number of decimal places (default: 0)
* @returns Formatted percentage string
* @example
* formatPercentage(0.15) // "15%"
* formatPercentage(0.1234, 1) // "12.3%"
*/
export function formatPercentage(value: number, decimals: number = 0): string {
return `${formatNumber(value * 100, decimals)}%`;
}
/**
* Formats a number as a compact notation (K, M, B)
* @param value - The number to format
* @returns Compact formatted string
* @example
* formatCompact(1234) // "1.2K"
* formatCompact(1234567) // "1.2M"
*/
export function formatCompact(value: number): string {
return new Intl.NumberFormat('en-US', {
notation: 'compact',
compactDisplay: 'short',
maximumFractionDigits: 1}).format(value);
}
|