goodeggs / goodeggs-money

Reliable money math with BigNumber wrapped inside Cents
MIT License
3 stars 0 forks source link

feat: include decimal point param in toString() #19

Closed piercebb closed 2 years ago

piercebb commented 2 years ago

Background

CNS and Garbanzo use money utils that will be better served in a centralized library.

For example, humanDollarsFromCents() converts a number into a dollar amount: humanDollarsFromCents(1000) -> '$10'

This is similar to existing function toString(), which converts cents into a human readable string dollar amount: new Cents(1000).toString() -> '$10.00'

This update will unblock removing a largely-unused util (@util/money) from CNS.

Possible follow ups include extending this function further to support showZeroAsFree & showZeroAsGift

Changes