Phone

Build Status Phone version Inline docs Hex.pm GitHub issues GitHub license

Phone number parser for numbers in international standard for Elixir.

About

What is, what isnt and what will be about Phone:

  1. It isnt: * Intended to work as libphonenumber. * Prepared to format numbers. * Necessary any information about the number if in international standard.
  2. It is: * A real parser, created to extract information based only in the number.
  3. It will be: * Prepared to work with numbers not only in the international standard. * Prepared for internationalization.

Vocabulary

Installation

Add to your depencies like any other hex package.

{:phone, "0.1.1"}

Contributing

There are may ways you can help this project grow, like:

Since for this project that would be a lot of repeating code, there is some helpers for creating a country module and a area.

Required fields for an area module:

defmodule Phone.NANP.CA.AB do
use Helper.Area
field :regex, ~r/^(1)(403|780|587)([2-9].{6})/
field :area_name, "Alberta"
field :area_type, "province"
field :area_abbreviation, "AB"
builder
end

Required fields for an country module:

defmodule Phone.NANP.AG do
use Helper.Country
field :regex, ~r/^(1)(268)([2-9].{6})/
field :country, "Antigua and Barbuda"
field :a2, "AG"
field :a3, "ATG"
match :regex
end
defmodule Phone.NANP.CA do
use Helper.Country
field :country, "Canada"
field :a2, "CA"
field :a3, "CAN"
field :modules, [
Phone.NANP.CA.AB,
Phone.NANP.CA.BC,
Phone.NANP.CA.MB,
Phone.NANP.CA.NB,
Phone.NANP.CA.NL,
Phone.NANP.CA.NS_PE,
Phone.NANP.CA.ON,
Phone.NANP.CA.QC,
Phone.NANP.CA.SK,
Phone.NANP.CA.Territory
]
match :modules
end

##Changelog

##Code of Conduct

License

Phone is under Apache v2.0 license. Check the LICENSE file for more details.