Skip to content

@toneflix/moneyMoney & Currency Made Simple

Format currency with ease, convert between currencies using live exchange rates, and perform calculations with proper precision.

Money

Quick Example ​

typescript
import { Money, Exchange } 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"

// Convert currencies
Exchange.setApiKey('your-api-key');
const euros = await Exchange.from('USD').to('EUR').convert(100);

console.log(euros); // e.g., 92.5

Installation ​

bash
npm install @toneflix/money
bash
pnpm add @toneflix/money
bash
yarn add @toneflix/money

Released under the MIT License.