Skip to content

kkempin/exiban

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ExIban

Library for manipulating and validating IBAN account numbers.

Installation

The package can be installed as:

  1. Add exiban to your list of dependencies in mix.exs:
```elixir
def deps do
  [{:exiban, "~> 0.0.1"}]
end
```
  1. Run mix deps.get in your console to fetch from Hex

Usage

iex> ExIban.valid?("GB82 WEST 1234 5698 7654 32")
true

iex> ExIban.valid?("GB82 WEST 999 9999 9999")
false

Ecto validator

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

Documentation

Hosted on http://hexdocs.pm/exiban/ExIban.html

Author

Krzysztof Kempiński

ExIban is released under the MIT License.

About

Elixir library for validation and manipulating IBAN bank account numbers.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages