Dinero.js

Create, calculate, and format money in JavaScript and TypeScript.

README

Dinero.js

Stability: alpha CircleCI NPM

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](https://github.com/dinerojs/dinero.js/tree/v1) and docs.


📦 Install


  1. ```sh
  2. npm install dinero.js@alpha

  3. # or

  4. yarn add dinero.js@alpha
  5. ```

⚡️ Quick start


Dinero objects are minimal. Every function in dinero.js is side-effect free, allowing you only to bundle exactly what you use.

  1. ``` js
  2. import { USD } from '@dinero.js/currencies';
  3. import { dinero, add } from 'dinero.js';

  4. const d1 = dinero({ amount: 500, currency: USD });
  5. const d2 = dinero({ amount: 800, currency: USD });

  6. add(d1, d2);
  7. ```

Check out the quick start guide on the documentation.

📚 Documentation


The documentation lets you learn about all aspects of the library.

- [Getting started](https://v2.dinerojs.com/docs/getting-started/quick-start) to get up and running quickly with Dinero.js
- [Core concepts](https://v2.dinerojs.com/docs/core-concepts/amount) to learn about the underlying principles behind the library
- [Guides](https://v2.dinerojs.com/docs/guides/using-different-amount-types) to dig deeper into specific use cases.
- [API](https://v2.dinerojs.com/docs/api/mutations/add) for a comprehensive list of available functions and their parameters.
- [FAQ](https://v2.dinerojs.com/docs/faq/does-dinerojs-support-cryptocurrencies) for common answers to questions you might have

Visit the full documentation to know more.

👥 Contributors

Dinero.js contributors

From v1

        <a href="https://sarahdayan.dev" rel="nofollow"
          ><img
            src="https://avatars1.githubusercontent.com/u/5370675?v=4"
            alt=""
            width="50"
            height="50"
/>
Sarah Dayan        >
        <a href="https://github.com/yacinehmito"
          ><img
            src="https://avatars1.githubusercontent.com/u/6893840?v=4"
            alt=""
            width="50"
            height="50"
/>
Yacine Hmito        >
        <a href="https://github.com/scotttrinh"
          ><img
            src="https://avatars1.githubusercontent.com/u/1682194?v=4"
            alt=""
            width="50"
            height="50"
/>
Scott Trinh        >
        <a href="https://rolandasb.com" rel="nofollow"
          ><img
            src="https://avatars0.githubusercontent.com/u/1409998?v=4"
            alt=""
            width="50"
            height="50"
/>
Rolandas Barysas        >
        <a href="https://www.luizpb.com/en/" rel="nofollow"
          ><img
            src="https://avatars1.githubusercontent.com/u/1798830?v=4"
            alt=""
            width="50"
            height="50"
/>
Luiz "Bills"        >
        <a href="https://kunst.com.br" rel="nofollow"
          ><img
            src="https://avatars2.githubusercontent.com/u/8649362?v=4"
            alt=""
            width="50"
            height="50"
/>
Leonardo Dino        >
        <a href="https://www.kizu.ru/" rel="nofollow"
          ><img
            src="https://avatars3.githubusercontent.com/u/177485?v=4"
            alt=""
            width="50"
            height="50"
/>
Roman Komarov        >
        <a href="http://jotaoncode.com/" rel="nofollow"
          ><img
            src="https://avatars3.githubusercontent.com/u/4575026?v=4"
            alt=""
            width="50"
            height="50"
/>
Juan Garcia        >
        <a href="https://github.com/frobinsonj"
          ><img
            src="https://avatars3.githubusercontent.com/u/16726902?v=4"
            alt=""
            width="50"
            height="50"
/>
Freddy Robinson        >
        <a href="https://twitter.com/andybrk" rel="nofollow"
          ><img
            src="https://avatars0.githubusercontent.com/u/273857?v=4"
            alt=""
            width="50"
            height="50"
/>
Andy Burke        >
        <a href="https://github.com/andrewiggins"
          ><img
            src="https://avatars3.githubusercontent.com/u/459878?v=4"
            alt=""
            width="50"
            height="50"
/>
Andre Wiggins        >
        <a href="https://desandro.com" rel="nofollow"
          ><img
            src="https://avatars0.githubusercontent.com/u/85566?v=4"
            alt=""
            width="50"
            height="50"
/>
David DeSandro        >
        <a href="http://maxk.se" rel="nofollow"
          ><img
            src="https://avatars1.githubusercontent.com/u/19932622?v=4"
            alt=""
            width="50"
            height="50"
/>
Max Körlinge        >
        <a href="https://github.com/dotpack"
          ><img
            src="https://avatars2.githubusercontent.com/u/1175814?v=4"
            alt=""
            width="50"
            height="50"
/>
Ilia Ermolin        >
        <a href="https://coina.ge" rel="nofollow"
          ><img
            src="https://avatars1.githubusercontent.com/u/1531750?v=4"
            alt=""
            width="50"
            height="50"
/>
Kevin Brown        >
        <a href="https://seankwalker.com" rel="nofollow"
          ><img
            src="https://avatars.githubusercontent.com/u/20524136?v=4"
            alt=""
            width="50"
            height="50"
/>
Sean Walker        >
        <a href="http://jnguyen.me/" rel="nofollow"
          ><img
            src="https://avatars0.githubusercontent.com/u/1127677?v=4"
            alt=""
            width="50"
            height="50"
/>
John Nguyen        >
        <a href="https://journal.artfuldev.com" rel="nofollow"
          ><img
            src="https://avatars.githubusercontent.com/u/3091087?v=4"
            alt=""
            width="50"
            height="50"
/>
Sudarsan Balaji        >

📜 License




Powered by Vercel