improve short format for balance credits >1K and >1M #184

Merged
akinwale merged 4 commits from format-big-credits into master 2019-08-16 16:54:39 +02:00
akinwale commented 2019-08-15 13:06:05 +02:00 (Migrated from github.com)
No description provided.
neb-b (Migrated from github.com) reviewed 2019-08-15 13:06:05 +02:00
kauffj (Migrated from github.com) reviewed 2019-08-15 18:00:29 +02:00
@ -6,0 +1,4 @@
export function formatCredits(amount, precision, shortFormat = false) {
let actualAmount = parseFloat(amount),
suffix = '';
if (Number.isNaN(actualAmount)) return '0';
kauffj (Migrated from github.com) commented 2019-08-15 18:00:22 +02:00

Would it make more sense for this functionality to be a parameter to formatCredits rather than a standalone function?

Would it make more sense for this functionality to be a parameter to formatCredits rather than a standalone function?
akinwale (Migrated from github.com) reviewed 2019-08-15 20:27:41 +02:00
@ -6,0 +1,4 @@
export function formatCredits(amount, precision, shortFormat = false) {
let actualAmount = parseFloat(amount),
suffix = '';
if (Number.isNaN(actualAmount)) return '0';
akinwale (Migrated from github.com) commented 2019-08-15 20:27:41 +02:00

I was trying to avoid having to update all the references to the method, as there are quite a few.

I was trying to avoid having to update all the references to the method, as there are quite a few.
kauffj (Migrated from github.com) reviewed 2019-08-15 21:55:02 +02:00
@ -6,0 +1,4 @@
export function formatCredits(amount, precision, shortFormat = false) {
let actualAmount = parseFloat(amount),
suffix = '';
if (Number.isNaN(actualAmount)) return '0';
kauffj (Migrated from github.com) commented 2019-08-15 21:55:02 +02:00

Why would you have to update the references if you add an optional 3rd parameter?

Why would you have to update the references if you add an optional 3rd parameter?
akinwale (Migrated from github.com) reviewed 2019-08-16 09:33:24 +02:00
@ -6,0 +1,4 @@
export function formatCredits(amount, precision, shortFormat = false) {
let actualAmount = parseFloat(amount),
suffix = '';
if (Number.isNaN(actualAmount)) return '0';
akinwale (Migrated from github.com) commented 2019-08-16 09:33:24 +02:00

I suppose I wouldn't have to, now that I think about it. I should be able to roll the functionality into the formatCredits method.

I suppose I wouldn't have to, now that I think about it. I should be able to roll the functionality into the `formatCredits` method.
kauffj (Migrated from github.com) approved these changes 2019-08-16 16:12:30 +02:00
kauffj (Migrated from github.com) left a comment

lgtm

lgtm
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: LBRYCommunity/lbry-redux#184
No description provided.