/** * Number Formatting Utilities * PORTED FROM: clj/ty/i18n/number.cljs * * Uses native Intl.NumberFormat for locale-aware number formatting * Supports currency, percent, compact notation, and custom precision */ export type NumberFormatType = 'number' | 'currency' | 'percent' | 'compact'; export interface FormatConfig { type: NumberFormatType; locale?: string; currency?: string; precision?: number; } /** * Format a number based on configuration * * @example * ```typescript * formatNumber(1234.56, { type: 'currency', currency: 'USD', locale: 'en-US' }) * // Returns: "$1,234.56" * * formatNumber(0.15, { type: 'percent', precision: 2 }) * // Returns: "15.00%" * * formatNumber(1234567, { type: 'compact' }) * // Returns: "1.2M" * ``` */ export declare function formatNumber(value: number, config: FormatConfig): string; /** * Parse a numeric string to a number * * Simple rule: the last occurring . or , is the decimal separator. * Everything else is stripped. This works for both US (1,234.56) and * European (1.234,56) input, and for mobile keyboards that use , as decimal. * * @example * ```typescript * parseNumericValue("1,234.56") // 1234.56 (last separator is .) * parseNumericValue("1.234,56") // 1234.56 (last separator is ,) * parseNumericValue("12,50") // 12.5 (last separator is ,) * parseNumericValue("12.50") // 12.5 (last separator is .) * parseNumericValue("1234") // 1234 * parseNumericValue("$1,234") // 1234 * parseNumericValue("15%") // 15 * parseNumericValue("") // null * ``` */ export declare function parseNumericValue(value: string): number | null; /** * Check if input type requires numeric formatting * * @example * ```typescript * shouldFormat('currency') // true * shouldFormat('percent') // true * shouldFormat('text') // false * ``` */ export declare function shouldFormat(type: string): boolean; /** * Format currency with locale * Convenience function for currency formatting */ export declare function formatCurrency(value: number, currency?: string, locale?: string): string; /** * Format percent with locale * Convenience function for percent formatting * * Note: Expects value as 0.15 for 15% */ export declare function formatPercent(value: number, locale?: string, precision?: number): string; /** * Format compact notation * Convenience function for compact formatting * * @example * formatCompact(1234567) // "1.2M" * formatCompact(1234) // "1.2K" */ export declare function formatCompact(value: number, locale?: string): string; //# sourceMappingURL=number-format.d.ts.map