Dinero.js lets you create, calculate, and format money safely in JavaScript and TypeScript.
v2.dinerojs.com/docs
Money is complex, and the primitives of the language aren't enough to properly represent it. Dinero.js is a JavaScript library that lets you express monetary values, but also perform mutations, conversions, comparisons, formatting, and overall make money manipulation easier and safer in your application.
ℹ️ Dinero.js v2 is currently in alpha. For v1, check the
v1
branch and docs.
npm install dinero.js@alpha
# or
yarn add dinero.js@alpha
Dinero
objects are minimal. Every function in dinero.js
is side-effect free, allowing you only to bundle exactly what you use.
import { USD } from '@dinero.js/currencies';
import { dinero, add } from 'dinero.js';
const d1 = dinero({ amount: 500, currency: USD });
const d2 = dinero({ amount: 800, currency: USD });
add(d1, d2);
Check out the quick start guide on the documentation.
The documentation lets you learn about all aspects of the library.
Visit the full documentation to know more.
From v1