local-currency-symbol
Version:
A utility package to map currency codes to their symbols and handle currency symbol positioning based on locale
43 lines (42 loc) • 1.3 kB
TypeScript
/**
* Interface for currency symbol position
*/
interface CurrencyPosition {
symbol: string;
position: "before" | "after";
}
/**
* Interface for formatted currency result with value
*/
interface FormattedCurrency {
symbol: string;
value: number;
position: "before" | "after";
}
/**
* Get currency symbol for a given currency code
* @param currencyCode Currency code (e.g., 'USD')
* @returns Currency symbol
*/
export declare const getCurrencySymbol: (currencyCode: string) => string;
/**
* Format currency with value and position
* @param options Configuration object
* @param options.value Numeric value to format
* @param options.currencyCode Currency code (e.g., 'USD')
* @param options.locale Locale code (default: 'en-US')
* @returns Formatted currency object containing symbol, value, and position
*/
export declare const formatCurrencyWithValue: ({ value, currencyCode, locale, }: {
value: number;
currencyCode: string;
locale?: string;
}) => FormattedCurrency;
/**
* Get currency symbol and position information
* @param currencyCode Currency code
* @param locale Locale code
* @returns Currency symbol and position information
*/
export declare const getCurrencyInfo: (currencyCode: string, locale?: string) => CurrencyPosition;
export {};