UNPKG

dinero.js

Version:

Create, calculate, and format money in JavaScript and TypeScript

34 lines (20 loc) 810 B
# dinero.js > 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. ## 📦 Install ```sh npm install dinero.js # or yarn add dinero.js ``` ## ⚡️ Quick start `Dinero` objects are minimal. Every function in `dinero.js` is side-effect free, allowing you only to bundle exactly what you use. ```js 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); ``` ## 📚 Documentation For full documentation, visit the [online documentation](https://dinerojs.com).