https://github.com/dideler/money.ex
Very simple library for money representation in Elixir
https://github.com/dideler/money.ex
Last synced: 12 days ago
JSON representation
Very simple library for money representation in Elixir
- Host: GitHub
- URL: https://github.com/dideler/money.ex
- Owner: dideler
- License: mit
- Created: 2024-04-29T15:32:30.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-12-11T16:17:58.000Z (6 months ago)
- Last Synced: 2026-05-27T03:07:08.782Z (21 days ago)
- Language: Elixir
- Homepage: https://hexdocs.pm/money_ex
- Size: 35.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# money.ex
Simple lightweight library for money representation in Elixir.
Not yet recommended for use in production while major version is 0.
Currently dog-fooding the library in a personal project.
## Installation
Add `money_ex` to your list of dependencies in `mix.exs`, then run `mix deps.get`.
From [Hex](https://hex.pm/packages/money_ex):
```elixir
def deps do
[
{:money_ex, "~> 0.3.0"}
]
end
```
From GitHub:
```elixir
def deps do
[
{:money_ex, github: "dideler/money.ex"}
]
end
```
From Git:
```elixir
def deps do
[
{:money_ex, git: "https://github.com/dideler/money.ex.git", tag: "0.3.0"}
]
end
```
The docs can be found at [https://hexdocs.pm/money_ex](https://hexdocs.pm/money_ex).
## Goals
- Keep it lightweight, minimal use of dependencies
- Keep it simple, prefer design decisions that reduce complexity
- Keep it reasonably fast and performant but not at the expense of simplicity
- Extendable and configurable, building blocks instead of trying to do everything
## Anti-goals
- Out of the box support for every currency, avoid maintenance hell
- Cryptocurrency support, only focused on fiat currencies for now
- Decimal or arbitrary precision for internal representation
## Roadmap
- initialise: ~~new~~, parse (maybe)
- predicates: ~~equals?~~, ~~zero?~~, ~~positive?~~, ~~negative?~~, ~~gt?~~, ~~lt?~~ ~~ge?/gte?~~ ~~le?/lte?~~ ~~eq?~~ ~~ne?~~, ~~pos?~~, ~~neg?~~
- operations: ~~add~~, ~~mul~~, ~~div~~, ~~sub~~, ~~abs~~, ~~convert~~, ~~compare~~, ~~split~~, ~~allocate~~
- presenters: ~~symbol~~, ~~name~~, ~~code~~, ~~to_s/to_string~~
- extendability: user-defined currencies, conversion rates, rounding strategy
- documentation: @docs for public API, organise with :group tag, doctests
- continuous delivery: dialyzer, credo, publish alias, warnings as errors
- protocols: ~~String.Chars~~, Inspect, Jason.Encoder, Ecto.Type