Library for manipulating and validating IBAN account numbers.
The package can be installed as:
- Add exiban to your list of dependencies in
mix.exs
:
```elixir
def deps do
[{:exiban, "~> 0.0.1"}]
end
```
- Run
mix deps.get
in your console to fetch from Hex
iex> ExIban.valid?("GB82 WEST 1234 5698 7654 32")
true
iex> ExIban.valid?("GB82 WEST 999 9999 9999")
false
defmodule User do
use Ecto.Schema
use Ecto.Model
schema "users" do
field :email, :string
field :iban, :string
end
def changeset(user, params \\ :empty) do
user
|> cast(params, ~w(iban email), ~w())
|> ExIban.EctoValidator.validate_iban(:iban)
end
end
Hosted on http://hexdocs.pm/exiban/ExIban.html
Krzysztof Kempiński
ExIban is released under the MIT License.