You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think we should encourage pure functional use of this library. For example:
# Prefer thistotal=Cents.percent(Cents.sum(10, 25), 0.5, transform:'round')
# Over thistotal=newCents(10).plus(newCents(25)).percent(0.5, transform:'round').toNumber()
We commonly serialize and deserialize cents values as numbers. I believe the interfaces between modules should be defined in terms of Numbers, not Cents objects, so that dependencies are explicit and so that individual modules can choose more appropriate libraries (like higher precision or big number) as needed.
In that world, new Cents() and .toNumber() are boilerplate to write and a small performance overhead.
The text was updated successfully, but these errors were encountered:
I think we should encourage pure functional use of this library. For example:
We commonly serialize and deserialize cents values as numbers. I believe the interfaces between modules should be defined in terms of Numbers, not Cents objects, so that dependencies are explicit and so that individual modules can choose more appropriate libraries (like higher precision or big number) as needed.
In that world,
new Cents()
and.toNumber()
are boilerplate to write and a small performance overhead.The text was updated successfully, but these errors were encountered: