fmtbtc
Format and convert bitcoin's display units (msat
, sat
, bit
, milli
and btc
).
Operates on the numbers as strings using move-decimal-point (the only dependency), so that it doesn't require a library for arbitrary-precision arithmetic.
The browserify bundle (including the move-decimal-point
dependency) weights 1,781 bytes when minified
or 868 bytes when gzipped.
Install
$ npm install fmtbtc
Use
// common case: convert from satoshis to btc // => 1 // => 1000.0005 // pretty print with commas separator // => 1,000.0005 // with other base/target units // => 100000 // => 100,000 // using utility `{from}2{to}` functions // => 1 // => 100,000
Using the browserify bundle (available at dist/fmtbtc.bundle.min.js
),
which exposes the library at window.fmtbtc
:
License
MIT