Create, calculate, and format money in JavaScript and TypeScript
This package exports Dinero.js. It works out of the box with number types, but you can adapt it for custom types or third-party libraries by implementing a custom calculator.
npm install dinero.js
# or
yarn add dinero.js
Dinero objects are minimal. Every function in dinero.js is side-effect free, allowing you only to bundle exactly what you use.
import { dinero, add } from 'dinero.js';
import { USD } from 'dinero.js/currencies';
const d1 = dinero({ amount: 500, currency: USD });
const d2 = dinero({ amount: 800, currency: USD });
add(d1, d2);
For full documentation, visit the online documentation.