elixirmoney / money

Elixir library for working with Money safer, easier, and fun... Is an interpretation of the Fowler's Money pattern in fun.prog.
https://hex.pm/packages/money/
MIT License
827 stars 141 forks source link

Return atoms from compare instead of -1/0/1 #137

Closed niknetniko closed 4 years ago

niknetniko commented 4 years ago

For example, DateTime.compare/2 returns :lt, :eq or :gt. This seams more readable than returning -1/0/1.

I'm willing to make a PR for this change, but since this breaks compatibility, it will probably require version 2.0, so I'm making this issue first to see if there is any interest in such a PR.

Nitrino commented 4 years ago

Hi @niknetniko I think we can add Money.cmp by analogy with Decimal.cmp and Decimal.compare. So we won’t break backward compatibility

niknetniko commented 4 years ago

That's a good solution, I'll make a PR.