@easymoney/crypto-formatter
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

easy money logo

@easymoney/crypto-formatter

npm-crypto-formatter npm type definitions deps-crypto-formatter size-crypto-formatter GitHub

Open in docs

Install

npm install @easymoney/crypto-formatter

or

yarn add @easymoney/crypto-formatter

or

CDN

Usage

import {createMoneyCryptoFormatter} from "@easymoney/crypto-formatter"
import { createMoney } from '@easymoney/money';
import {cryptoCurrenciesMap} from "@easymoney/currencies"

const money = createMoney({amount: 5, currency: "LTC" });

const formatted = createMoneyCryptoFormatter().format(money);
// => "0.00000005LTC"

const money1 = createMoney({amount: 50, currency: cryptoCurrenciesMap.ETH });

const formatted1 = createMoneyCryptoFormatter().format(money);
// => "0.000000000000000005ETH"

const money = { amount: 5, currency: "ETH" };

const formattedValue = createFormatter().format(createMoney(money), {
        currencyPosition: -1
});

// => ETH0.000000000000000005

Package Sidebar

Install

npm i @easymoney/crypto-formatter

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

37.1 kB

Total Files

22

Last publish

Collaborators

  • whispers12