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
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
toString
with decimal point parameter