Socket
Socket
Sign inDemoInstall

cryptocurrency-decimals

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cryptocurrency-decimals

Utility library for formatting cryptocurrency coins and token amounts to the correct number of decimal places


Version published
Weekly downloads
3
increased by200%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

cryptocurrency-decimals

Simple utility library for formatting cryptocurrency coins and token amounts to the correct number of decimal places

Installation

npm i cryptocurrency-decimals --save

Usage

import decimals, { decimalize } from 'cryptocurrency-decimals';

const btcAmount = 0.99884421;
const price = 10213;
const usdtAmount = decimalize(btcAmount * price, 'USDT');

// logs 10201.19
console.log(usdtAmount);

// logs 8
console.log(decimals['BTC']);

Symbols

Currently only a few symbols are supported, please submit a PR to add more!

ADA
AUD
AUDT
BCH
BTC
ETH
NANO
NEO
USD
USDT
VEN
XRB
XRP

FAQs

Last updated on 20 Jul 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc