import type { FormatResult, FormatResultObject, SupportedCurrency } from "./types"; import { type CurrencyCode } from "./currencies"; /** * Clears the internal memoization cache. * * Use this to free memory or reset state during testing. * The cache automatically evicts old entries when full (LRU with 100 entries max). * * @example * clearFormatCache(); */ export declare const clearFormatCache: () => void; /** * Returns the current number of entries in the memoization cache. * * Useful for debugging or monitoring cache usage. * Maximum cache size is 100 entries. * * @returns The number of cached format results * * @example * console.log(getFormatCacheSize()); // 42 */ export declare const getFormatCacheSize: () => number; /** * Formats a numeric amount as a localized currency string. * * Supports 165+ ISO 4217 currency codes with proper symbol placement, * thousands separators, and decimal formatting. Results are memoized * for performance (LRU cache with 100 entries). * * @param options - Formatting options * @param options.amount - The numeric amount to format (supports negative values) * @param options.code - ISO 4217 currency code (e.g., 'USD', 'EUR', 'JPY') * @param options.returnType - Optional: 'array' (default) or 'object' * @returns Tuple of [formattedWithSymbol, formattedWithoutSymbol, symbol] or object with formatted, value, symbol * * @example * // Basic usage (returns array) * formatCurrency({ amount: 1234.56, code: 'USD' }); * // Returns: ['$1,234.56', '1,234.56', '$'] * * @example * // Object return type * formatCurrency({ amount: 1234.56, code: 'USD', returnType: 'object' }); * // Returns: { formatted: '$1,234.56', value: '1,234.56', symbol: '$' } * * @example * // European format (period for thousands, comma for decimals) * formatCurrency({ amount: 1234.56, code: 'EUR' }); * // Returns: ['€1.234,56', '1.234,56', '€'] * * @example * // Zero-decimal currency * formatCurrency({ amount: 1234.56, code: 'JPY' }); * // Returns: ['¥ 1,235', '1,235', '¥'] * * @example * // Negative amount * formatCurrency({ amount: -99.99, code: 'GBP' }); * // Returns: ['-£99.99', '-99.99', '£'] * * @example * // Unknown currency code (returns plain number) * formatCurrency({ amount: 100, code: 'XXX' }); * // Returns: ['100', '100', ''] */ export declare function formatCurrency(options: { amount: number; code: CurrencyCode | string; }): FormatResult; export declare function formatCurrency(options: { amount: number; code: CurrencyCode | string; returnType: "array"; }): FormatResult; export declare function formatCurrency(options: { amount: number; code: CurrencyCode | string; returnType: "object"; }): FormatResultObject; /** * Returns a list of all supported currencies. * * Useful for building currency selector dropdowns or validating user input. * Returns 165+ currencies sorted alphabetically by code. * * @returns Array of objects with `code` and `name` properties * * @example * const currencies = getSupportedCurrencies(); * // [ * // { code: 'AED', name: 'United Arab Emirates Dirham' }, * // { code: 'AFN', name: 'Afghanistan Afghani' }, * // ... * // ] * * @example * // Building a dropdown * getSupportedCurrencies().map(c => ( * * )); */ export declare const getSupportedCurrencies: () => SupportedCurrency[];