💰
Easy Currency Formatting
Format numbers as currency with proper symbols and formatting for all major world currencies.
Format currency with ease, convert between currencies using live exchange rates, and perform calculations with proper precision.

import { Money, Exchange, FrankfurterApi } from '@toneflix/money';
// Format currency
Money.format(1234.56, 'USD'); // "$1,234.56"
// Perform calculations
const total = new Money(100, 'USD').add(50).multiply(2).subtract(25);
console.log(total.format()); // "$275.00"
// ExchangeRateApi is the default provider.
// Existing API key configuration remains supported.
Exchange.setApiKey('your-api-key');
const euros = await Exchange.from('USD').to('EUR').convert(100);
console.log(euros); // e.g., 92.5
// Or switch to FrankfurterApi.
// Frankfurter does not require an API key.
Exchange.setProvider(FrankfurterApi);
const pounds = await Exchange.from('USD').to('GBP').convert(100);
console.log(pounds); // e.g., 78.4