/** * 数字格式化 - 基于 Intl.NumberFormat * * 禁止使用 toFixed * 完全依赖 Intl API 做本地化数字展示 */ export interface FormatNumberOptions { /** BCP 47 语言标签,默认从浏览器读取 */ locale?: string; /** 最小小数位数 */ minimumFractionDigits?: number; /** 最大小数位数 */ maximumFractionDigits?: number; /** 是否使用分组分隔符(如千位分隔符) */ useGrouping?: boolean; /** 表示法 */ notation?: 'standard' | 'scientific' | 'engineering' | 'compact'; /** 紧凑表示法的显示风格 */ compactDisplay?: 'short' | 'long'; } /** * 格式化数字 * * @param value - 数值 * @param options - 格式化选项(兼容 Intl.NumberFormatOptions 超集) * @returns 格式化后的数字字符串 * * @example * ```typescript * formatNumber(12345.678, { locale: 'zh-CN', maximumFractionDigits: 2 }); * // => "12,345.68" * * formatNumber(1234567, { notation: 'compact', locale: 'en-US' }); * // => "1.2M" * ``` */ export declare function formatNumber(value: number, options?: FormatNumberOptions & Intl.NumberFormatOptions): string; //# sourceMappingURL=number.d.ts.map