@easymoney/formatter
v1.1.0
Published
Best way to do money in js
Downloads
82
Maintainers
Readme
@easymoney/formatter
Install
npm install @easymoney/formatter
or
yarn add @easymoney/formatter
or
CDN
Usage
import {createMoneyIntlFormatter} from "@easymoney/formatter"
import { createMoney } from '@easymoney/money';
const money = createMoney({amount: 5, currency: "USD"});
const money1 = createMoney({amount: 50, currency: "USD"});
const formatted = createMoneyIntlFormatter().format(money);
// => "$0.05"
const formatted1 = createMoneyIntlFormatter()
.format(money,
"en-US",
{minimumFractionDigits: 1, maximumFractionDigits: 1});
// => "$0.5"