@easymoney/bigint-money
v1.0.1
Published
Best way to do money in js
Downloads
4
Maintainers
Readme
@easymoney/bigint-money
Install
npm install @easymoney/bigint-money
or
yarn add @easymoney/bigint-money
or
CDN
Usage
import { createBigIntMoney } from "@easymoney/bigint-money";
const money = createBigIntMoney({ amount: 100n, currency: "USD" });
const money2 = createBigIntMoney({ amount: 100n, currency: "USD" });
const result = money.add(money2);
result.getAmount();
// => 200n
import { createBigIntMoney } from '@easymoney/bigint-money';
const money1 = createBigIntMoney({ amount: 100n, currency: 'USD' });
const result = money1.divide(5);
const result2 = money1.divide(1 / 2);
result.getAmount();
// ->20n
result2.getAmount();
// ->200n