monetochka
Version:
Simple, fast and zero-dependency currency formatting library
28 lines • 1.2 kB
TypeScript
export interface MLocaleSettings {
g?: string;
d?: string;
t?: string;
h?: string;
f?: number;
fMax?: number;
}
export declare type MFiat = 'AED' | 'ARS' | 'AUD' | 'BRL' | 'CAD' | 'CHF' | 'CLP' | 'CNY' | 'COP' | 'CZK' | 'DKK' | 'DOP' | 'EGP' | 'EUR' | 'GBP' | 'HKD' | 'HRK' | 'HUF' | 'IDR' | 'INR' | 'IRR' | 'JPY' | 'KES' | 'KRW' | 'KZT' | 'MAD' | 'MXN' | 'MYR' | 'NGN' | 'NOK' | 'NZD' | 'PEN' | 'PHP' | 'PKR' | 'PLN' | 'RON' | 'RUB' | 'SAR' | 'SEK' | 'SGD' | 'THB' | 'TRY' | 'TZS' | 'UAH' | 'USD' | 'VEF' | 'VND' | 'ZAR';
export declare type MCrypto = 'BTC' | 'LTC' | 'ETH' | 'BCH' | 'DASH' | 'USDT';
export declare type MCurrency = MFiat | MCrypto | string;
export interface MOptions {
locale?: string;
isCrypto?: boolean;
siRounding?: boolean;
siUnits?: MSIUnits;
siPrecision?: number;
throwOnError?: boolean;
errorValue?: string;
fractionDigits?: number;
maximumFractionDigits?: number;
}
export declare type MSIUnits = [string, string?, string?, string?, string?, string?, string?, string?];
export declare const _default: {
format: (amount: number, currency: string, options?: MOptions) => string;
parse: (string: string, currency: string) => number;
};
export default _default;