dinero.js
Version:
Create, calculate, and format money in JavaScript and TypeScript
34 lines (20 loc) • 810 B
Markdown
> 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.
```sh
npm install dinero.js
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.
```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);
```
For full documentation, visit the [online documentation](https://dinerojs.com).