Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Fix/format amount #293

Merged
merged 2 commits into from
Jun 23, 2016
Merged

Fix/format amount #293

merged 2 commits into from
Jun 23, 2016

Conversation

isocolsky
Copy link
Contributor

  • Provide short representation & full precision representation.
  • Truncate exceeding decimals (instead of rounding).

@coveralls
Copy link

coveralls commented Jun 23, 2016

Coverage Status

Coverage increased (+0.01%) to 94.965% when pulling f8ca6d1 on isocolsky:fix/format-amount into e1bb8d7 on bitpay:master.

@@ -161,8 +165,10 @@ Utils.formatAmount = function(satoshis, unit, opts) {
opts = opts || {};

var u = Constants.UNITS[unit];
var amount = (satoshis / u.toSatoshis).toFixed(u.maxDecimals);
return addSeparators(amount, opts.thousandsSeparator || ',', opts.decimalSeparator || '.', u.minDecimals);
var precision = opts.fullPrecision ? 'full' : 'short';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always help to have opts :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always help to have opts :)

@matiu matiu merged commit 94b5633 into bitpay:master Jun 23, 2016
sparklecoin pushed a commit to sparklecoin/bitcore-wallet-client that referenced this pull request Nov 13, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants