diff --git a/.gitignore b/.gitignore index 2baaf95..be36baa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /_build +/bench/snapshots /cover /doc /docs diff --git a/.travis.yml b/.travis.yml index 4b87dd5..e91b4c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,8 @@ language: elixir elixir: - 1.2.6 - - 1.3.2 - - 1.4.0 + - 1.3.4 + - 1.4.2 otp_release: - 18.3 diff --git a/CHANGELOG.md b/CHANGELOG.md index 9483477..a98f2b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ #Changelog +##v0.4.0: + * Updates `Helper.Countries` and `Helper.Area` behavior + * Several changes to improve performance. + * Include `valid?/1`. + * Remove warning from v0.3 + ##v0.3.10: * Correct number validation for Norway. * Correct Ireland area codes validation. diff --git a/bench/phone_bench.exs b/bench/phone_bench.exs new file mode 100644 index 0000000..d8daddc --- /dev/null +++ b/bench/phone_bench.exs @@ -0,0 +1,19 @@ +defmodule PhoneBench do + use Benchfella + + @nanp_phone_number "12536301234" + @andorra_phone_number "376123456" + @zimbabwe_phone_number "2634333224" + + bench "Phone.parse/1 with an NANP phone number" do + {:ok, _result} = Phone.parse(@nanp_phone_number) + end + + bench "Phone.parse/1 with an Andorra phone number" do + {:ok, _result} = Phone.parse(@andorra_phone_number) + end + + bench "Phone.parse/1 with a Zimbabwe phone number" do + {:ok, _result} = Phone.parse(@zimbabwe_phone_number) + end +end diff --git a/lib/helpers/area.ex b/lib/helpers/area.ex index 042d6b1..62efa50 100644 --- a/lib/helpers/area.ex +++ b/lib/helpers/area.ex @@ -2,22 +2,16 @@ defmodule Helper.Area do @moduledoc false defmacro __using__(_) do quote do - import Helper.Area @moduledoc false - end - end - defmacro field(name, value) do - quote do - defp unquote(name)(), do: unquote(value) - end - end + import Helper.Area - defmacro builder do - quote do - def match?(number) do - Regex.match?(regex(), number) - end + def regex, do: "" + def area_name, do: "" + def area_type, do: "" + def area_abbreviation, do: "" + + defoverridable [regex: 0, area_name: 0, area_type: 0, area_abbreviation: 0] def builder(number) do [_ | country] = @@ -43,22 +37,59 @@ defmodule Helper.Area do area_abbreviation: area_abbreviation() } end + end + end - def build(number) do - if match?(number) do - {:ok, builder(number)} - else - {:error, "Not a valid phone number."} + defmacro matcher(codes) do + [quote do + def codes, do: unquote(codes) + end] + ++ + Enum.map(codes, + fn code -> + quote do + def match?(unquote(code) <> _ = number) do + Regex.match?(regex(), number) + end end - end - - def build!(number) do - if match?(number) do - builder(number) - else - raise ArgumentError, message: "Not a valid phone number." + end) + ++ + [quote do + def match?(_number), do: false + end] + ++ + Enum.map(codes, + fn code -> + quote do + def build(unquote(code) <> _ = number) do + if match?(number) do + {:ok, builder(number)} + else + {:error, "Not a valid phone number."} + end + end end - end - end + end) + ++ + [quote do + def build(_number), do: {:error, "Not a valid phone number."} + end] + ++ + Enum.map(codes, + fn code -> + quote do + def build!(unquote(code) <> _ = number) do + if match?(number) do + builder(number) + else + raise ArgumentError, message: "Not a valid phone number." + end + end + end + end) + ++ + [quote do + def build!(_number), do: raise ArgumentError, message: "Not a valid phone number." + end] end end diff --git a/lib/helpers/country.ex b/lib/helpers/country.ex index 2fcebda..14e5a77 100644 --- a/lib/helpers/country.ex +++ b/lib/helpers/country.ex @@ -2,22 +2,22 @@ defmodule Helper.Country do @moduledoc false defmacro __using__(_) do quote do - import Helper.Country @moduledoc false - end - end - defmacro field(name, value) do - quote do - def unquote(name)(), do: unquote(value) + import Helper.Country + + def regex, do: "" + def country, do: "" + def a2, do: "" + def a3, do: "" + + defoverridable [regex: 0, country: 0, a2: 0, a3: 0] end end - defp regex_matcher do - quote do - def match?(number) do - Regex.match?(regex(), number) - end + defmacro matcher(:regex, codes) do + [quote do + def codes, do: unquote(codes) def builder(number) do [[_, code, area, number]] = Regex.scan(regex(), number) @@ -31,58 +31,80 @@ defmodule Helper.Country do number: number } end + end] + ++ + Enum.map(codes, + fn code -> + quote do + def match?(unquote(code) <> _ = number) do + Regex.match?(regex(), number) + end - def build(number) do - if match?(number) do - {:ok, builder(number)} - else - {:error, "Not a valid phone number."} - end - end + def build(unquote(code) <> _ = number) do + if match?(number) do + {:ok, builder(number)} + else + {:error, "Not a valid phone number."} + end + end - def build!(number) do - if match?(number) do - builder(number) - else - raise ArgumentError, "Not a valid phone number." + def build!(unquote(code) <> _ = number) do + if match?(number) do + builder(number) + else + raise ArgumentError, "Not a valid phone number." + end + end end - end - end + end) + ++ + [quote do + def match?(_number), do: false + + def build!(_number), do: raise ArgumentError, "Not a valid phone number." + + def build(_number), do: {:error, "Not a valid phone number."} + end] end - defp modules_matcher do - quote do - def match?(number) do - ms = Enum.filter(modules(), fn m -> m.match?(number) end) - length(ms) > 0 - end + defmacro matcher(:modules, modules) do + modules = Enum.map(modules, &(Macro.expand(&1, __CALLER__))) - def build(number) do - if match?(number) do - [module] = Enum.filter(modules(), fn m -> m.match?(number) end) - module.build(number) - else - {:error, "Not a valid phone number."} - end - end + all_codes = Enum.reduce(modules, [], fn m, acc -> acc ++ m.codes end) - def build!(number) do - if match?(number) do - [module] = Enum.filter(modules(), fn m -> m.match?(number) end) - module.build!(number) - else - raise ArgumentError, message: "Not a valid phone number." - end - end - end - end + [quote do + def codes, do: unquote(all_codes) + end] + ++ + Enum.map(modules, + fn module -> + Enum.map(module.codes, + fn code -> + quote do + def match?(unquote(code) <> _ = number) do + unquote(module).match?(number) + end - defmacro match(matcher) do - case matcher do - :regex -> regex_matcher() - :modules -> modules_matcher() - true -> - raise ArgumentError, "You can only match against :regex or :modules, passed #{inspect matcher}" - end + def build(unquote(code) <> _ = number) do + unquote(module).build(number) + end + + def build!(unquote(code) <> _ = number) do + unquote(module).build!(number) + end + end + end) + end) + ++ + [quote do + def match?(_number), do: false + + def build(_number), do: {:error, "Not a valid phone number."} + + def build!(_number), do: raise ArgumentError, message: "Not a valid phone number." + end] end + + defmacro matcher(_, _), + do: raise ArgumentError, "You can only match against :regex or :modules" end diff --git a/lib/phone.ex b/lib/phone.ex index f01cde5..017c9ee 100644 --- a/lib/phone.ex +++ b/lib/phone.ex @@ -12,12 +12,6 @@ defmodule Phone do import Helper.Parser - @after_compile __MODULE__ - def __after_compile__(_env, _bytecode) do - IO.puts ":phone, v0.3.0" - IO.puts "WARN: parse/2 function has changed. Please take a look at the documentation." - end - @doc """ Parses a string or integer and returns a map with information about that number. @@ -38,13 +32,9 @@ defmodule Phone do """ @spec parse(String.t) :: {:ok, Map.t} def parse(number) when is_bitstring(number) do - number = clear(number) - number = try do - number |> String.to_integer |> Integer.to_string - rescue - _ -> "" - end - Phone.Countries.build(number) + number + |> prepare_number + |> Phone.Countries.build end @spec parse(pos_integer) :: {:ok, Map.t} @@ -57,15 +47,33 @@ defmodule Phone do {:error, "Not a valid parameter, only string or integer."} end - defp clear(number) when is_bitstring(number) do - remove = String.graphemes("+()- ") + @doc false + defp prepare_number(number) do + number = clear(number) + + try do + number |> String.to_integer |> Integer.to_string + rescue + _ -> "" + end + end + @doc false + defp clear(number) when is_bitstring(number) do number |> String.graphemes - |> Enum.filter(fn n -> ! Enum.any?(remove, fn r -> r == n end) end) + |> Enum.filter(fn n -> valid_char(n) end) |> Enum.join("") end + @doc false + defp valid_char("+"), do: false + defp valid_char("("), do: false + defp valid_char(")"), do: false + defp valid_char("-"), do: false + defp valid_char(" "), do: false + defp valid_char(_), do: true + @doc """ Same as `parse/1`, except it raises on error. @@ -111,4 +119,36 @@ defmodule Phone do @spec parse!(pos_integer, Atom.t) :: Map.t country_parser() + + @doc """ + Returns `true` if the number can be parsed, otherwhise returns `false`. + + ``` + iex> Phone.valid?("555132345678") + true + + iex> Phone.valid?("+55(51)3234-5678") + true + + iex> Phone.valid?("55 51 3234-5678") + true + + iex> Phone.valid?(555132345678) + true + + ``` + """ + @spec parse(String.t) :: boolean + def valid?(number) when is_bitstring(number) do + number + |> prepare_number + |> Phone.Countries.match? + end + + @spec parse(pos_integer) :: boolean + def valid?(number) when is_integer(number) do + number + |> to_string + |> valid? + end end diff --git a/lib/phone/ad.ex b/lib/phone/ad.ex index 58c3e3f..692d376 100644 --- a/lib/phone/ad.ex +++ b/lib/phone/ad.ex @@ -1,8 +1,10 @@ defmodule Phone.AD do use Helper.Country - field :regex, ~r/^(376)()(.{6})/ - field :country, "Andorra" - field :a2, "AD" - field :a3, "AND" - match :regex + + def regex, do: ~r/^(376)()(.{6})/ + def country, do: "Andorra" + def a2, do: "AD" + def a3, do: "AND" + + matcher :regex, ["376"] end diff --git a/lib/phone/ae.ex b/lib/phone/ae.ex index 04be0f2..ca27680 100644 --- a/lib/phone/ae.ex +++ b/lib/phone/ae.ex @@ -1,8 +1,10 @@ defmodule Phone.AE do use Helper.Country - field :regex, ~r/^(971)(.)(.{7})/ - field :country, "United Arab Emirates" - field :a2, "AE" - field :a3, "ARE" - match :regex + + def regex, do: ~r/^(971)(.)(.{7})/ + def country, do: "United Arab Emirates" + def a2, do: "AE" + def a3, do: "ARE" + + matcher :regex, ["971"] end diff --git a/lib/phone/af.ex b/lib/phone/af.ex index 6c65d1f..680f558 100644 --- a/lib/phone/af.ex +++ b/lib/phone/af.ex @@ -1,8 +1,10 @@ defmodule Phone.AF do use Helper.Country - field :regex, ~r/^(93)(..)(.{7})/ - field :country, "Afghanistan" - field :a2, "AF" - field :a3, "AFG" - match :regex + + def regex, do: ~r/^(93)(..)(.{7})/ + def country, do: "Afghanistan" + def a2, do: "AF" + def a3, do: "AFG" + + matcher :regex, ["93"] end diff --git a/lib/phone/al.ex b/lib/phone/al.ex index 5588b8a..0c85c3d 100644 --- a/lib/phone/al.ex +++ b/lib/phone/al.ex @@ -1,8 +1,10 @@ defmodule Phone.AL do use Helper.Country - field :regex, ~r/^(355)()(.{7})/ - field :country, "Albania" - field :a2, "AL" - field :a3, "ALB" - match :regex + + def regex, do: ~r/^(355)()(.{7})/ + def country, do: "Albania" + def a2, do: "AL" + def a3, do: "ALB" + + matcher :regex, ["355"] end diff --git a/lib/phone/am.ex b/lib/phone/am.ex index 11db26c..f96e3e0 100644 --- a/lib/phone/am.ex +++ b/lib/phone/am.ex @@ -1,8 +1,10 @@ defmodule Phone.AM do use Helper.Country - field :regex, ~r/^(374)()(.{8})/ - field :country, "Armenia" - field :a2, "AM" - field :a3, "ARM" - match :regex + + def regex, do: ~r/^(374)()(.{8})/ + def country, do: "Armenia" + def a2, do: "AM" + def a3, do: "ARM" + + matcher :regex, ["374"] end diff --git a/lib/phone/ao.ex b/lib/phone/ao.ex index 376a872..deb641b 100644 --- a/lib/phone/ao.ex +++ b/lib/phone/ao.ex @@ -1,8 +1,10 @@ defmodule Phone.AO do use Helper.Country - field :regex, ~r/^(244)()(9)/ - field :country, "Angola" - field :a2, "AO" - field :a3, "AGO" - match :regex + + def regex, do: ~r/^(244)()(9)/ + def country, do: "Angola" + def a2, do: "AO" + def a3, do: "AGO" + + matcher :regex, ["244"] end diff --git a/lib/phone/ar.ex b/lib/phone/ar.ex index 9c2c6bc..25207e3 100644 --- a/lib/phone/ar.ex +++ b/lib/phone/ar.ex @@ -1,8 +1,10 @@ defmodule Phone.AR do use Helper.Country - field :regex, ~r/^(54)()(.{10})/ - field :country, "Argentina" - field :a2, "AR" - field :a3, "ARG" - match :regex + + def regex, do: ~r/^(54)()(.{10})/ + def country, do: "Argentina" + def a2, do: "AR" + def a3, do: "ARG" + + matcher :regex, ["54"] end diff --git a/lib/phone/at.ex b/lib/phone/at.ex index 357eca9..392f950 100644 --- a/lib/phone/at.ex +++ b/lib/phone/at.ex @@ -1,8 +1,10 @@ defmodule Phone.AT do use Helper.Country - field :regex, ~r/^(43)()(.+)/ - field :country, "Austria" - field :a2, "AT" - field :a3, "AUT" - match :regex + + def regex, do: ~r/^(43)()(.+)/ + def country, do: "Austria" + def a2, do: "AT" + def a3, do: "AUT" + + matcher :regex, ["43"] end diff --git a/lib/phone/au.ex b/lib/phone/au.ex index f75a19e..fb4ddd5 100644 --- a/lib/phone/au.ex +++ b/lib/phone/au.ex @@ -1,8 +1,10 @@ defmodule Phone.AU do use Helper.Country - field :regex, ~r/^(61)([1-478])(.{8})/ - field :country, "Australia" - field :a2, "AU" - field :a3, "AUS" - match :regex + + def regex, do: ~r/^(61)([1-478])(.{8})/ + def country, do: "Australia" + def a2, do: "AU" + def a3, do: "AUS" + + matcher :regex, ["61"] end diff --git a/lib/phone/aw.ex b/lib/phone/aw.ex index f62477e..87c5a09 100644 --- a/lib/phone/aw.ex +++ b/lib/phone/aw.ex @@ -1,8 +1,10 @@ defmodule Phone.AW do use Helper.Country - field :regex, ~r/^(297)()(.{7})/ - field :country, "Aruba" - field :a2, "AW" - field :a3, "ABW" - match :regex + + def regex, do: ~r/^(297)()(.{7})/ + def country, do: "Aruba" + def a2, do: "AW" + def a3, do: "ABW" + + matcher :regex, ["297"] end diff --git a/lib/phone/az.ex b/lib/phone/az.ex index 0f3e4f2..184b092 100644 --- a/lib/phone/az.ex +++ b/lib/phone/az.ex @@ -1,8 +1,10 @@ defmodule Phone.AZ do use Helper.Country - field :regex, ~r/^(994)()(.{9})/ - field :country, "Azerbeijan" - field :a2, "AZ" - field :a3, "AZE" - match :regex + + def regex, do: ~r/^(994)()(.{9})/ + def country, do: "Azerbeijan" + def a2, do: "AZ" + def a3, do: "AZE" + + matcher :regex, ["994"] end diff --git a/lib/phone/ba.ex b/lib/phone/ba.ex index d0154cd..5af83ff 100644 --- a/lib/phone/ba.ex +++ b/lib/phone/ba.ex @@ -1,8 +1,10 @@ defmodule Phone.BA do use Helper.Country - field :regex, ~r/^(387)(..)(.{5,6})/ - field :country, "Bosnia and Herzegovina" - field :a2, "BA" - field :a3, "BIH" - match :regex + + def regex, do: ~r/^(387)(..)(.{5,6})/ + def country, do: "Bosnia and Herzegovina" + def a2, do: "BA" + def a3, do: "BIH" + + matcher :regex, ["387"] end diff --git a/lib/phone/bd.ex b/lib/phone/bd.ex index 07e43a1..fd55184 100644 --- a/lib/phone/bd.ex +++ b/lib/phone/bd.ex @@ -1,8 +1,10 @@ defmodule Phone.BD do use Helper.Country - field :regex, ~r/^(880)()(.{10})/ - field :country, "Bangladesh" - field :a2, "BD" - field :a3, "BGD" - match :regex + + def regex, do: ~r/^(880)()(.{10})/ + def country, do: "Bangladesh" + def a2, do: "BD" + def a3, do: "BGD" + + matcher :regex, ["880"] end diff --git a/lib/phone/be.ex b/lib/phone/be.ex index 91e291c..75cb2a2 100644 --- a/lib/phone/be.ex +++ b/lib/phone/be.ex @@ -1,8 +1,10 @@ defmodule Phone.BE do use Helper.Country - field :regex, ~r/^(32)()(.{9})/ - field :country, "Belgium" - field :a2, "BE" - field :a3, "BEL" - match :regex + + def regex, do: ~r/^(32)()(.{9})/ + def country, do: "Belgium" + def a2, do: "BE" + def a3, do: "BEL" + + matcher :regex, ["32"] end diff --git a/lib/phone/bg.ex b/lib/phone/bg.ex index b660d00..9513550 100644 --- a/lib/phone/bg.ex +++ b/lib/phone/bg.ex @@ -1,8 +1,10 @@ defmodule Phone.BG do use Helper.Country - field :regex, ~r/^(359)()(.{8,9})/ - field :country, "Bulgaria" - field :a2, "BG" - field :a3, "BGR" - match :regex + + def regex, do: ~r/^(359)()(.{8,9})/ + def country, do: "Bulgaria" + def a2, do: "BG" + def a3, do: "BGR" + + matcher :regex, ["359"] end diff --git a/lib/phone/bh.ex b/lib/phone/bh.ex index c813096..3a8c152 100644 --- a/lib/phone/bh.ex +++ b/lib/phone/bh.ex @@ -1,8 +1,10 @@ defmodule Phone.BH do use Helper.Country - field :regex, ~r/^(973)()(.{8})/ - field :country, "Bahrain" - field :a2, "BH" - field :a3, "BHR" - match :regex + + def regex, do: ~r/^(973)()(.{8})/ + def country, do: "Bahrain" + def a2, do: "BH" + def a3, do: "BHR" + + matcher :regex, ["973"] end diff --git a/lib/phone/bi.ex b/lib/phone/bi.ex index 4329da5..fe36931 100644 --- a/lib/phone/bi.ex +++ b/lib/phone/bi.ex @@ -1,8 +1,10 @@ defmodule Phone.BI do use Helper.Country - field :regex, ~r/^(257)()(.{8})/ - field :country, "Burundi" - field :a2, "BI" - field :a3, "BDI" - match :regex + + def regex, do: ~r/^(257)()(.{8})/ + def country, do: "Burundi" + def a2, do: "BI" + def a3, do: "BDI" + + matcher :regex, ["257"] end diff --git a/lib/phone/bj.ex b/lib/phone/bj.ex index 5d9d5ac..ec63808 100644 --- a/lib/phone/bj.ex +++ b/lib/phone/bj.ex @@ -1,8 +1,10 @@ defmodule Phone.BJ do use Helper.Country - field :regex, ~r/^(229)()(.{8})/ - field :country, "Benin" - field :a2, "BJ" - field :a3, "BEN" - match :regex + + def regex, do: ~r/^(229)()(.{8})/ + def country, do: "Benin" + def a2, do: "BJ" + def a3, do: "BEN" + + matcher :regex, ["229"] end diff --git a/lib/phone/bn.ex b/lib/phone/bn.ex index e143a10..7c57e65 100644 --- a/lib/phone/bn.ex +++ b/lib/phone/bn.ex @@ -1,8 +1,10 @@ defmodule Phone.BN do use Helper.Country - field :regex, ~r/^(673)()(.{7})/ - field :country, "Brunei" - field :a2, "BN" - field :a3, "BRN" - match :regex + + def regex, do: ~r/^(673)()(.{7})/ + def country, do: "Brunei" + def a2, do: "BN" + def a3, do: "BRN" + + matcher :regex, ["673"] end diff --git a/lib/phone/bo.ex b/lib/phone/bo.ex index f077b38..d6aefd8 100644 --- a/lib/phone/bo.ex +++ b/lib/phone/bo.ex @@ -1,8 +1,10 @@ defmodule Phone.BO do use Helper.Country - field :regex, ~r/^(591)()(.{8})/ - field :country, "Bolivia" - field :a2, "BO" - field :a3, "BOL" - match :regex + + def regex, do: ~r/^(591)()(.{8})/ + def country, do: "Bolivia" + def a2, do: "BO" + def a3, do: "BOL" + + matcher :regex, ["581"] end diff --git a/lib/phone/br.ex b/lib/phone/br.ex index df1351b..7a5918b 100644 --- a/lib/phone/br.ex +++ b/lib/phone/br.ex @@ -1,23 +1,14 @@ defmodule Phone.BR do use Helper.Country - field :country, "Brazil" - field :a2, "BR" - field :a3, "BRA" - field :modules, [ - Phone.BR.AC, Phone.BR.AL, - Phone.BR.AM, Phone.BR.AP, - Phone.BR.BA, Phone.BR.CE, - Phone.BR.DF, Phone.BR.ES, - Phone.BR.GO, Phone.BR.MA, - Phone.BR.MT, Phone.BR.MS, - Phone.BR.MG, Phone.BR.PA, - Phone.BR.PB, Phone.BR.PE, - Phone.BR.PI, Phone.BR.PR, - Phone.BR.RJ, Phone.BR.RN, - Phone.BR.RO, Phone.BR.RR, - Phone.BR.RS, Phone.BR.SC, - Phone.BR.SE, Phone.BR.SP, - Phone.BR.TO - ] - match :modules + + def country, do: "Brazil" + def a2, do: "BR" + def a3, do: "BRA" + + matcher :modules, [Phone.BR.AC, Phone.BR.AL, Phone.BR.AM, Phone.BR.AP, Phone.BR.BA, + Phone.BR.CE, Phone.BR.DF, Phone.BR.ES, Phone.BR.GO, Phone.BR.MA, + Phone.BR.MT, Phone.BR.MS, Phone.BR.MG, Phone.BR.PA, Phone.BR.PB, + Phone.BR.PE, Phone.BR.PI, Phone.BR.PR, Phone.BR.RJ, Phone.BR.RN, + Phone.BR.RO, Phone.BR.RR, Phone.BR.RS, Phone.BR.SC, Phone.BR.SE, + Phone.BR.SP, Phone.BR.TO] end diff --git a/lib/phone/br/ac.ex b/lib/phone/br/ac.ex index ecec612..9ffcb2a 100644 --- a/lib/phone/br/ac.ex +++ b/lib/phone/br/ac.ex @@ -1,8 +1,10 @@ defmodule Phone.BR.AC do use Helper.Area - field :regex, ~r/^(55)(68)([2-5|89].{7}|9[89].{7})$/ - field :area_name, "Acre" - field :area_type, "state" - field :area_abbreviation, "AC" - builder() + + def regex, do: ~r/^(55)(68)([2-5|89].{7}|9[89].{7})$/ + def area_name, do: "Acre" + def area_type, do: "state" + def area_abbreviation, do: "AC" + + matcher ["5568"] end diff --git a/lib/phone/br/al.ex b/lib/phone/br/al.ex index 927bc36..0d6a6cf 100644 --- a/lib/phone/br/al.ex +++ b/lib/phone/br/al.ex @@ -1,8 +1,10 @@ defmodule Phone.BR.AL do use Helper.Area - field :regex, ~r/^(55)(82)([2-5|89].{7}|9[89].{7})$/ - field :area_name, "Alagoas" - field :area_type, "state" - field :area_abbreviation, "AL" - builder() + + def regex, do: ~r/^(55)(82)([2-5|89].{7}|9[89].{7})$/ + def area_name, do: "Alagoas" + def area_type, do: "state" + def area_abbreviation, do: "AL" + + matcher ["5582"] end diff --git a/lib/phone/br/am.ex b/lib/phone/br/am.ex index 8329de0..01a90c7 100644 --- a/lib/phone/br/am.ex +++ b/lib/phone/br/am.ex @@ -1,8 +1,10 @@ defmodule Phone.BR.AM do use Helper.Area - field :regex, ~r/^(55)(9[27])([2-5|89].{7}|9[89].{7})$/ - field :area_name, "Amazonas" - field :area_type, "state" - field :area_abbreviation, "AM" - builder() + + def regex, do: ~r/^(55)(9[27])([2-5|89].{7}|9[89].{7})$/ + def area_name, do: "Amazonas" + def area_type, do: "state" + def area_abbreviation, do: "AM" + + matcher ["5592", "5597"] end diff --git a/lib/phone/br/ap.ex b/lib/phone/br/ap.ex index 2d8fe83..71e3273 100644 --- a/lib/phone/br/ap.ex +++ b/lib/phone/br/ap.ex @@ -1,8 +1,10 @@ defmodule Phone.BR.AP do use Helper.Area - field :regex, ~r/^(55)(96)([2-5|89].{7}|9[89].{7})$/ - field :area_name, "Amapá" - field :area_type, "state" - field :area_abbreviation, "AP" - builder() + + def regex, do: ~r/^(55)(96)([2-5|89].{7}|9[89].{7})$/ + def area_name, do: "Amapá" + def area_type, do: "state" + def area_abbreviation, do: "AP" + + matcher ["5596"] end diff --git a/lib/phone/br/ba.ex b/lib/phone/br/ba.ex index acaa434..e4e1de5 100644 --- a/lib/phone/br/ba.ex +++ b/lib/phone/br/ba.ex @@ -1,8 +1,10 @@ defmodule Phone.BR.BA do use Helper.Area - field :regex, ~r/^(55)(7[1|3-5|7])([2-5|89].{7}|9[89].{7}|78.{6})$/ - field :area_name, "Bahia" - field :area_type, "state" - field :area_abbreviation, "BA" - builder() + + def regex, do: ~r/^(55)(7[1|3-5|7])([2-5|89].{7}|9[89].{7}|78.{6})$/ + def area_name, do: "Bahia" + def area_type, do: "state" + def area_abbreviation, do: "BA" + + matcher ["5571", "5573", "5574", "5575", "5577"] end diff --git a/lib/phone/br/ce.ex b/lib/phone/br/ce.ex index 4474e04..d0b1867 100644 --- a/lib/phone/br/ce.ex +++ b/lib/phone/br/ce.ex @@ -1,8 +1,10 @@ defmodule Phone.BR.CE do use Helper.Area - field :regex, ~r/^(55)(8[58])([2-5|89].{7}|9[89].{7}|78.{6})$/ - field :area_name, "Ceará" - field :area_type, "state" - field :area_abbreviation, "CE" - builder() + + def regex, do: ~r/^(55)(8[58])([2-5|89].{7}|9[89].{7}|78.{6})$/ + def area_name, do: "Ceará" + def area_type, do: "state" + def area_abbreviation, do: "CE" + + matcher ["5585", "5588"] end diff --git a/lib/phone/br/df.ex b/lib/phone/br/df.ex index e5c905b..b358576 100644 --- a/lib/phone/br/df.ex +++ b/lib/phone/br/df.ex @@ -1,8 +1,10 @@ defmodule Phone.BR.DF do use Helper.Area - field :regex, ~r/^(55)(61)([2-5|89].{7}|9[89].{7}|78.{6})$/ - field :area_name, "Distrito Federal" - field :area_type, "district" - field :area_abbreviation, "DF" - builder() + + def regex, do: ~r/^(55)(61)([2-5|89].{7}|9[89].{7}|78.{6})$/ + def area_name, do: "Distrito Federal" + def area_type, do: "district" + def area_abbreviation, do: "DF" + + matcher ["5561"] end diff --git a/lib/phone/br/es.ex b/lib/phone/br/es.ex index 26963bb..87a1fc5 100644 --- a/lib/phone/br/es.ex +++ b/lib/phone/br/es.ex @@ -1,8 +1,10 @@ defmodule Phone.BR.ES do use Helper.Area - field :regex, ~r/^(55)(2[78])([2-5|89].{7}|9[89].{7}|78.{6})$/ - field :area_name, "Espírito Santo" - field :area_type, "state" - field :area_abbreviation, "ES" - builder() + + def regex, do: ~r/^(55)(2[78])([2-5|89].{7}|9[89].{7}|78.{6})$/ + def area_name, do: "Espírito Santo" + def area_type, do: "state" + def area_abbreviation, do: "ES" + + matcher ["5527", "5528"] end diff --git a/lib/phone/br/go.ex b/lib/phone/br/go.ex index 523f7e8..e113577 100644 --- a/lib/phone/br/go.ex +++ b/lib/phone/br/go.ex @@ -1,8 +1,10 @@ defmodule Phone.BR.GO do use Helper.Area - field :regex, ~r/^(55)(6[24])([2-5|89].{7}|9[89].{7}|78.{6})$/ - field :area_name, "Goiás" - field :area_type, "state" - field :area_abbreviation, "GO" - builder() + + def regex, do: ~r/^(55)(6[24])([2-5|89].{7}|9[89].{7}|78.{6})$/ + def area_name, do: "Goiás" + def area_type, do: "state" + def area_abbreviation, do: "GO" + + matcher ["5562", "5564"] end diff --git a/lib/phone/br/ma.ex b/lib/phone/br/ma.ex index 9038243..6714829 100644 --- a/lib/phone/br/ma.ex +++ b/lib/phone/br/ma.ex @@ -1,8 +1,10 @@ defmodule Phone.BR.MA do use Helper.Area - field :regex, ~r/^(55)(9[98])([2-5|89].{7}|9[89].{7})$/ - field :area_name, "Maranhão" - field :area_type, "state" - field :area_abbreviation, "MA" - builder() + + def regex, do: ~r/^(55)(9[98])([2-5|89].{7}|9[89].{7})$/ + def area_name, do: "Maranhão" + def area_type, do: "state" + def area_abbreviation, do: "MA" + + matcher ["5598", "5599"] end diff --git a/lib/phone/br/mg.ex b/lib/phone/br/mg.ex index 07b7c36..22e3107 100644 --- a/lib/phone/br/mg.ex +++ b/lib/phone/br/mg.ex @@ -1,8 +1,10 @@ defmodule Phone.BR.MG do use Helper.Area - field :regex, ~r/^(55)(3[1-5|78])([2-5|89].{7}|9[89].{7}|7[78].{6})$/ - field :area_name, "Minas Gerais" - field :area_type, "state" - field :area_abbreviation, "MG" - builder() + + def regex, do: ~r/^(55)(3[1-5|78])([2-5|89].{7}|9[89].{7}|7[78].{6})$/ + def area_name, do: "Minas Gerais" + def area_type, do: "state" + def area_abbreviation, do: "MG" + + matcher ["5531", "5532", "5533", "5534", "5535", "5537", "5538"] end diff --git a/lib/phone/br/ms.ex b/lib/phone/br/ms.ex index ea6711e..a9ca0a7 100644 --- a/lib/phone/br/ms.ex +++ b/lib/phone/br/ms.ex @@ -1,8 +1,10 @@ defmodule Phone.BR.MS do use Helper.Area - field :regex, ~r/^(55)(67)([2-5|89].{7}|9[89].{7})$/ - field :area_name, "Mato Grosso do Sul" - field :area_type, "state" - field :area_abbreviation, "MS" - builder() + + def regex, do: ~r/^(55)(67)([2-5|89].{7}|9[89].{7})$/ + def area_name, do: "Mato Grosso do Sul" + def area_type, do: "state" + def area_abbreviation, do: "MS" + + matcher ["5567"] end diff --git a/lib/phone/br/mt.ex b/lib/phone/br/mt.ex index 1f13c2d..b7b3ac2 100644 --- a/lib/phone/br/mt.ex +++ b/lib/phone/br/mt.ex @@ -1,8 +1,10 @@ defmodule Phone.BR.MT do use Helper.Area - field :regex, ~r/^(55)(6[56])([2-5|89].{7}|9[89].{7}|78.{6})$/ - field :area_name, "Mato Grosso" - field :area_type, "state" - field :area_abbreviation, "MT" - builder() + + def regex, do: ~r/^(55)(6[56])([2-5|89].{7}|9[89].{7}|78.{6})$/ + def area_name, do: "Mato Grosso" + def area_type, do: "state" + def area_abbreviation, do: "MT" + + matcher ["5565", "5566"] end diff --git a/lib/phone/br/pa.ex b/lib/phone/br/pa.ex index 279ecec..3300310 100644 --- a/lib/phone/br/pa.ex +++ b/lib/phone/br/pa.ex @@ -1,8 +1,10 @@ defmodule Phone.BR.PA do use Helper.Area - field :regex, ~r/^(55)(9[134])([2-5|89].{7}|9[89].{7})$/ - field :area_name, "Pará" - field :area_type, "state" - field :area_abbreviation, "PA" - builder() + + def regex, do: ~r/^(55)(9[134])([2-5|89].{7}|9[89].{7})$/ + def area_name, do: "Pará" + def area_type, do: "state" + def area_abbreviation, do: "PA" + + matcher ["5591", "5593", "5594"] end diff --git a/lib/phone/br/pb.ex b/lib/phone/br/pb.ex index e64ea9e..d587495 100644 --- a/lib/phone/br/pb.ex +++ b/lib/phone/br/pb.ex @@ -1,8 +1,10 @@ defmodule Phone.BR.PB do use Helper.Area - field :regex, ~r/^(55)(83)([2-5|89].{7}|9[89].{7})$/ - field :area_name, "Paraíba" - field :area_type, "state" - field :area_abbreviation, "PB" - builder() + + def regex, do: ~r/^(55)(83)([2-5|89].{7}|9[89].{7})$/ + def area_name, do: "Paraíba" + def area_type, do: "state" + def area_abbreviation, do: "PB" + + matcher ["5583"] end diff --git a/lib/phone/br/pe.ex b/lib/phone/br/pe.ex index 679c272..d23183c 100644 --- a/lib/phone/br/pe.ex +++ b/lib/phone/br/pe.ex @@ -1,8 +1,10 @@ defmodule Phone.BR.PE do use Helper.Area - field :regex, ~r/^(55)(8[17])([2-5|89].{7}|9[89].{7})$/ - field :area_name, "Pernambuco" - field :area_type, "state" - field :area_abbreviation, "PE" - builder() + + def regex, do: ~r/^(55)(8[17])([2-5|89].{7}|9[89].{7})$/ + def area_name, do: "Pernambuco" + def area_type, do: "state" + def area_abbreviation, do: "PE" + + matcher ["5581", "5587"] end diff --git a/lib/phone/br/pi.ex b/lib/phone/br/pi.ex index 83afe12..2b1b9bd 100644 --- a/lib/phone/br/pi.ex +++ b/lib/phone/br/pi.ex @@ -1,8 +1,10 @@ defmodule Phone.BR.PI do use Helper.Area - field :regex, ~r/^(55)(8[69])([2-5|89].{7}|9[89].{7})/ - field :area_name, "Piauí" - field :area_type, "state" - field :area_abbreviation, "PI" - builder() + + def regex, do: ~r/^(55)(8[69])([2-5|89].{7}|9[89].{7})/ + def area_name, do: "Piauí" + def area_type, do: "state" + def area_abbreviation, do: "PI" + + matcher ["5586", "5589"] end diff --git a/lib/phone/br/pr.ex b/lib/phone/br/pr.ex index b9f3ae0..3b6de52 100644 --- a/lib/phone/br/pr.ex +++ b/lib/phone/br/pr.ex @@ -1,8 +1,10 @@ defmodule Phone.BR.PR do use Helper.Area - field :regex, ~r/^(55)(4[1-6])([2-5|89].{7}|9[89].{7}|78.{6})$/ - field :area_name, "Paraná" - field :area_type, "state" - field :area_abbreviation, "PR" - builder() + + def regex, do: ~r/^(55)(4[1-6])([2-5|89].{7}|9[89].{7}|78.{6})$/ + def area_name, do: "Paraná" + def area_type, do: "state" + def area_abbreviation, do: "PR" + + matcher ["5541", "5546"] end diff --git a/lib/phone/br/rj.ex b/lib/phone/br/rj.ex index e4f516c..cc4cd32 100644 --- a/lib/phone/br/rj.ex +++ b/lib/phone/br/rj.ex @@ -1,8 +1,10 @@ defmodule Phone.BR.RJ do use Helper.Area - field :regex, ~r/^(55)(2[124])([2-5|89].{7}|9[89].{7}|7[078].{6})$/ - field :area_name, "Rio de Janeiro" - field :area_type, "state" - field :area_abbreviation, "RJ" - builder() + + def regex, do: ~r/^(55)(2[124])([2-5|89].{7}|9[89].{7}|7[078].{6})$/ + def area_name, do: "Rio de Janeiro" + def area_type, do: "state" + def area_abbreviation, do: "RJ" + + matcher ["5521", "5522", "5524"] end diff --git a/lib/phone/br/rn.ex b/lib/phone/br/rn.ex index 8579be4..ca23c6d 100644 --- a/lib/phone/br/rn.ex +++ b/lib/phone/br/rn.ex @@ -1,8 +1,10 @@ defmodule Phone.BR.RN do use Helper.Area - field :regex, ~r/^(55)(84)([2-5|89].{7}|9[89].{7})$/ - field :area_name, "Rio Grande do Norte" - field :area_type, "state" - field :area_abbreviation, "RN" - builder() + + def regex, do: ~r/^(55)(84)([2-5|89].{7}|9[89].{7})$/ + def area_name, do: "Rio Grande do Norte" + def area_type, do: "state" + def area_abbreviation, do: "RN" + + matcher ["5584"] end diff --git a/lib/phone/br/ro.ex b/lib/phone/br/ro.ex index 39d2495..e8baaf8 100644 --- a/lib/phone/br/ro.ex +++ b/lib/phone/br/ro.ex @@ -1,8 +1,10 @@ defmodule Phone.BR.RO do use Helper.Area - field :regex, ~r/^(55)(69)([2-5|89].{7}|9[89].{7})$/ - field :area_name, "Rondônia" - field :area_type, "state" - field :area_abbreviation, "RO" - builder() + + def regex, do: ~r/^(55)(69)([2-5|89].{7}|9[89].{7})$/ + def area_name, do: "Rondônia" + def area_type, do: "state" + def area_abbreviation, do: "RO" + + matcher ["5569"] end diff --git a/lib/phone/br/rr.ex b/lib/phone/br/rr.ex index f809c60..7317f9b 100644 --- a/lib/phone/br/rr.ex +++ b/lib/phone/br/rr.ex @@ -1,8 +1,10 @@ defmodule Phone.BR.RR do use Helper.Area - field :regex, ~r/^(55)(95)([2-5|89].{7}|9[89].{7})$/ - field :area_name, "Roraima" - field :area_type, "state" - field :area_abbreviation, "RR" - builder() + + def regex, do: ~r/^(55)(95)([2-5|89].{7}|9[89].{7})$/ + def area_name, do: "Roraima" + def area_type, do: "state" + def area_abbreviation, do: "RR" + + matcher ["5595"] end diff --git a/lib/phone/br/rs.ex b/lib/phone/br/rs.ex index 9580a59..702c65e 100644 --- a/lib/phone/br/rs.ex +++ b/lib/phone/br/rs.ex @@ -1,8 +1,10 @@ defmodule Phone.BR.RS do use Helper.Area - field :regex, ~r/^(55)(5[1|3-5])([2-5|89].{7}|9[89].{7}|78.{6})$/ - field :area_name, "Rio Grande do Sul" - field :area_type, "state" - field :area_abbreviation, "RS" - builder() + + def regex, do: ~r/^(55)(5[1|3-5])([2-5|89].{7}|9[89].{7}|78.{6})$/ + def area_name, do: "Rio Grande do Sul" + def area_type, do: "state" + def area_abbreviation, do: "RS" + + matcher ["5551", "5553", "5554", "5555"] end diff --git a/lib/phone/br/sc.ex b/lib/phone/br/sc.ex index 995926d..4a16759 100644 --- a/lib/phone/br/sc.ex +++ b/lib/phone/br/sc.ex @@ -1,8 +1,10 @@ defmodule Phone.BR.SC do use Helper.Area - field :regex, ~r/^(55)(4[7-9])([2-5|89].{7}|9[89].{7}|78.{6})$/ - field :area_name, "Santa Catarina" - field :area_type, "state" - field :area_abbreviation, "SC" - builder() + + def regex, do: ~r/^(55)(4[7-9])([2-5|89].{7}|9[89].{7}|78.{6})$/ + def area_name, do: "Santa Catarina" + def area_type, do: "state" + def area_abbreviation, do: "SC" + + matcher ["5547", "5548", "5549"] end diff --git a/lib/phone/br/se.ex b/lib/phone/br/se.ex index b6915e3..2f01ce4 100644 --- a/lib/phone/br/se.ex +++ b/lib/phone/br/se.ex @@ -1,8 +1,10 @@ defmodule Phone.BR.SE do use Helper.Area - field :regex, ~r/^(55)(79)([2-5|89].{7}|9[89].{7})$/ - field :area_name, "Sergipe" - field :area_type, "state" - field :area_abbreviation, "SE" - builder() + + def regex, do: ~r/^(55)(79)([2-5|89].{7}|9[89].{7})$/ + def area_name, do: "Sergipe" + def area_type, do: "state" + def area_abbreviation, do: "SE" + + matcher ["5579"] end diff --git a/lib/phone/br/sp.ex b/lib/phone/br/sp.ex index 89e4a15..df43d81 100644 --- a/lib/phone/br/sp.ex +++ b/lib/phone/br/sp.ex @@ -1,8 +1,10 @@ defmodule Phone.BR.SP do use Helper.Area - field :regex, ~r/^(55)(1[1-9])([2-5|89].{7}|9.{8}|7[07-9].{6})$/ - field :area_name, "São Paulo" - field :area_type, "state" - field :area_abbreviation, "SP" - builder() + + def regex, do: ~r/^(55)(1[1-9])([2-5|89].{7}|9.{8}|7[07-9].{6})$/ + def area_name, do: "São Paulo" + def area_type, do: "state" + def area_abbreviation, do: "SP" + + matcher ["5511", "5512", "5513", "5514", "5515", "5516", "5517", "5518", "5519"] end diff --git a/lib/phone/br/to.ex b/lib/phone/br/to.ex index c74aaf1..2ada250 100644 --- a/lib/phone/br/to.ex +++ b/lib/phone/br/to.ex @@ -1,8 +1,10 @@ defmodule Phone.BR.TO do use Helper.Area - field :regex, ~r/^(55)(63)([2-5|89].{7}|9[89].{7})$/ - field :area_name, "Tocantins" - field :area_type, "state" - field :area_abbreviation, "TO" - builder() + + def regex, do: ~r/^(55)(63)([2-5|89].{7}|9[89].{7})$/ + def area_name, do: "Tocantins" + def area_type, do: "state" + def area_abbreviation, do: "TO" + + matcher ["5563"] end diff --git a/lib/phone/bt.ex b/lib/phone/bt.ex index d233e93..e274a44 100644 --- a/lib/phone/bt.ex +++ b/lib/phone/bt.ex @@ -1,8 +1,10 @@ defmodule Phone.BT do use Helper.Country - field :regex, ~r/^(975)()(.{7,8})/ - field :country, "Bhutan" - field :a2, "BT" - field :a3, "BTN" - match :regex + + def regex, do: ~r/^(975)()(.{7,8})/ + def country, do: "Bhutan" + def a2, do: "BT" + def a3, do: "BTN" + + matcher :regex, ["975"] end diff --git a/lib/phone/bw.ex b/lib/phone/bw.ex index 4e66e17..1e77845 100644 --- a/lib/phone/bw.ex +++ b/lib/phone/bw.ex @@ -1,8 +1,10 @@ defmodule Phone.BW do use Helper.Country - field :regex, ~r/^(267)()(.{7})/ - field :country, "Botswana" - field :a2, "BW" - field :a3, "BWA" - match :regex + + def regex, do: ~r/^(267)()(.{7})/ + def country, do: "Botswana" + def a2, do: "BW" + def a3, do: "BWA" + + matcher :regex, ["267"] end diff --git a/lib/phone/by.ex b/lib/phone/by.ex index 6ba611b..4c86a43 100644 --- a/lib/phone/by.ex +++ b/lib/phone/by.ex @@ -1,8 +1,10 @@ defmodule Phone.BY do use Helper.Country - field :regex, ~r/^(375)()(.{9})/ - field :country, "Belarus" - field :a2, "BY" - field :a3, "BLR" - match :regex + + def regex, do: ~r/^(375)()(.{9})/ + def country, do: "Belarus" + def a2, do: "BY" + def a3, do: "BLR" + + matcher :regex, ["375"] end diff --git a/lib/phone/bz.ex b/lib/phone/bz.ex index 7f3c1b2..82c200e 100644 --- a/lib/phone/bz.ex +++ b/lib/phone/bz.ex @@ -1,8 +1,10 @@ defmodule Phone.BZ do use Helper.Country - field :regex, ~r/^(501)()(.{7})/ - field :country, "Belize" - field :a2, "BZ" - field :a3, "BLZ" - match :regex + + def regex, do: ~r/^(501)()(.{7})/ + def country, do: "Belize" + def a2, do: "BZ" + def a3, do: "BLZ" + + matcher :regex, ["501"] end diff --git a/lib/phone/cd.ex b/lib/phone/cd.ex index 86217ac..f46992d 100644 --- a/lib/phone/cd.ex +++ b/lib/phone/cd.ex @@ -1,8 +1,10 @@ defmodule Phone.CD do use Helper.Country - field :regex, ~r/^(243)(.)(.{7})/ - field :country, "Democratic Republic of Congo" - field :a2, "CD" - field :a3, "COD" - match :regex + + def regex, do: ~r/^(243)(.)(.{7})/ + def country, do: "Democratic Republic of Congo" + def a2, do: "CD" + def a3, do: "COD" + + matcher :regex, ["243"] end diff --git a/lib/phone/cf.ex b/lib/phone/cf.ex index 70b5373..ed3ed8e 100644 --- a/lib/phone/cf.ex +++ b/lib/phone/cf.ex @@ -1,8 +1,10 @@ defmodule Phone.CF do use Helper.Country - field :regex, ~r/^(236)()(.{8})/ - field :country, "Central African Republic" - field :a2, "CF" - field :a3, "CAF" - match :regex + + def regex, do: ~r/^(236)()(.{8})/ + def country, do: "Central African Republic" + def a2, do: "CF" + def a3, do: "CAF" + + matcher :regex, ["236"] end diff --git a/lib/phone/cg.ex b/lib/phone/cg.ex index e917321..54d5348 100644 --- a/lib/phone/cg.ex +++ b/lib/phone/cg.ex @@ -1,8 +1,10 @@ defmodule Phone.CG do use Helper.Country - field :regex, ~r/^(242)(.{4})(.{5})/ - field :country, "Congo" - field :a2, "CG" - field :a3, "COG" - match :regex + + def regex, do: ~r/^(242)(.{4})(.{5})/ + def country, do: "Congo" + def a2, do: "CG" + def a3, do: "COG" + + matcher :regex, ["242"] end diff --git a/lib/phone/ch.ex b/lib/phone/ch.ex index da748c7..ebdee6c 100644 --- a/lib/phone/ch.ex +++ b/lib/phone/ch.ex @@ -1,8 +1,10 @@ defmodule Phone.CH do use Helper.Country - field :regex, ~r/^(41)()(.{9,10})/ - field :country, "Switzerland" - field :a2, "CH" - field :a3, "CHE" - match :regex + + def regex, do: ~r/^(41)()(.{9,10})/ + def country, do: "Switzerland" + def a2, do: "CH" + def a3, do: "CHE" + + matcher :regex, ["41"] end diff --git a/lib/phone/ci.ex b/lib/phone/ci.ex index 4c615e2..d4d92a1 100644 --- a/lib/phone/ci.ex +++ b/lib/phone/ci.ex @@ -1,8 +1,10 @@ defmodule Phone.CI do use Helper.Country - field :regex, ~r/^(225)(..)(.{6})/ - field :country, "Ivory Coast" - field :a2, "CI" - field :a3, "CIV" - match :regex + + def regex, do: ~r/^(225)(..)(.{6})/ + def country, do: "Ivory Coast" + def a2, do: "CI" + def a3, do: "CIV" + + matcher :regex, ["225"] end diff --git a/lib/phone/ck.ex b/lib/phone/ck.ex index 1714086..173770c 100644 --- a/lib/phone/ck.ex +++ b/lib/phone/ck.ex @@ -1,8 +1,10 @@ defmodule Phone.CK do use Helper.Country - field :regex, ~r/^(682)()(.{5})/ - field :country, "Cook Islands" - field :a2, "CK" - field :a3, "COK" - match :regex + + def regex, do: ~r/^(682)()(.{5})/ + def country, do: "Cook Islands" + def a2, do: "CK" + def a3, do: "COK" + + matcher :regex, ["682"] end diff --git a/lib/phone/cl.ex b/lib/phone/cl.ex index d18bd0e..b0d675c 100644 --- a/lib/phone/cl.ex +++ b/lib/phone/cl.ex @@ -1,8 +1,10 @@ defmodule Phone.CL do use Helper.Country - field :regex, ~r/^(56)()(.{9})/ - field :country, "Chile" - field :a2, "CL" - field :a3, "CHL" - match :regex + + def regex, do: ~r/^(56)()(.{9})/ + def country, do: "Chile" + def a2, do: "CL" + def a3, do: "CHL" + + matcher :regex, ["56"] end diff --git a/lib/phone/cm.ex b/lib/phone/cm.ex index 04a0331..db351c8 100644 --- a/lib/phone/cm.ex +++ b/lib/phone/cm.ex @@ -1,8 +1,10 @@ defmodule Phone.CM do use Helper.Country - field :regex, ~r/^(237)()(.{8})/ - field :country, "Cameroon" - field :a2, "CM" - field :a3, "CMR" - match :regex + + def regex, do: ~r/^(237)()(.{8})/ + def country, do: "Cameroon" + def a2, do: "CM" + def a3, do: "CMR" + + matcher :regex, ["237"] end diff --git a/lib/phone/cn.ex b/lib/phone/cn.ex index 1a28f73..e7b1a47 100644 --- a/lib/phone/cn.ex +++ b/lib/phone/cn.ex @@ -1,8 +1,10 @@ defmodule Phone.CN do use Helper.Country - field :regex, ~r/^(86)()(.+)/ - field :country, "China" - field :a2, "CN" - field :a3, "CHN" - match :regex + + def regex, do: ~r/^(86)()(.+)/ + def country, do: "China" + def a2, do: "CN" + def a3, do: "CHN" + + matcher :regex, ["86"] end diff --git a/lib/phone/co.ex b/lib/phone/co.ex index 92f5f91..3afccc3 100644 --- a/lib/phone/co.ex +++ b/lib/phone/co.ex @@ -1,8 +1,10 @@ defmodule Phone.CO do use Helper.Country - field :regex, ~r/^(57)()(.+)/ - field :country, "Colombia" - field :a2, "CO" - field :a3, "COL" - match :regex + + def regex, do: ~r/^(57)()(.+)/ + def country, do: "Colombia" + def a2, do: "CO" + def a3, do: "COL" + + matcher :regex, ["57"] end diff --git a/lib/phone/countries.ex b/lib/phone/countries.ex index 02ce7fe..501cb43 100644 --- a/lib/phone/countries.ex +++ b/lib/phone/countries.ex @@ -1,6 +1,7 @@ defmodule Phone.Countries do use Helper.Country - field :modules, [ + + matcher :modules, [ Phone.AD, Phone.AE, Phone.AF, Phone.AL, Phone.AM, Phone.AO, Phone.AR, Phone.AT, Phone.AU, Phone.AW, Phone.AZ, Phone.BA, Phone.BD, Phone.BE, Phone.BG, Phone.BH, Phone.BI, Phone.BJ, @@ -36,5 +37,4 @@ defmodule Phone.Countries do Phone.VU, Phone.WF, Phone.WS, Phone.YE, Phone.ZA, Phone.ZM, Phone.ZW, Phone.NANP ] - match :modules end diff --git a/lib/phone/cr.ex b/lib/phone/cr.ex index 1d12e25..e5ea8ec 100644 --- a/lib/phone/cr.ex +++ b/lib/phone/cr.ex @@ -1,8 +1,10 @@ defmodule Phone.CR do use Helper.Country - field :regex, ~r/^(506)()(.{8})/ - field :country, "Costa Rica" - field :a2, "CR" - field :a3, "CRI" - match :regex + + def regex, do: ~r/^(506)()(.{8})/ + def country, do: "Costa Rica" + def a2, do: "CR" + def a3, do: "CRI" + + matcher :regex, ["506"] end diff --git a/lib/phone/cu.ex b/lib/phone/cu.ex index e336840..e2b713a 100644 --- a/lib/phone/cu.ex +++ b/lib/phone/cu.ex @@ -1,8 +1,10 @@ defmodule Phone.CU do use Helper.Country - field :regex, ~r/^(53)()(.{8})/ - field :country, "Cuba" - field :a2, "CU" - field :a3, "CUB" - match :regex + + def regex, do: ~r/^(53)()(.{8})/ + def country, do: "Cuba" + def a2, do: "CU" + def a3, do: "CUB" + + matcher :regex, ["53"] end diff --git a/lib/phone/cv.ex b/lib/phone/cv.ex index 58d4938..602e1ee 100644 --- a/lib/phone/cv.ex +++ b/lib/phone/cv.ex @@ -1,8 +1,10 @@ defmodule Phone.CV do use Helper.Country - field :regex, ~r/^(238)()(.{7})/ - field :country, "Cape Verde" - field :a2, "CV" - field :a3, "CPV" - match :regex + + def regex, do: ~r/^(238)()(.{7})/ + def country, do: "Cape Verde" + def a2, do: "CV" + def a3, do: "CPV" + + matcher :regex, ["238"] end diff --git a/lib/phone/cw.ex b/lib/phone/cw.ex index 8a77e29..f45dd77 100644 --- a/lib/phone/cw.ex +++ b/lib/phone/cw.ex @@ -1,8 +1,10 @@ defmodule Phone.CW do use Helper.Country - field :regex, ~r/^(599)(9)(.{7})/ - field :country, "Curaçao" - field :a2, "CW" - field :a3, "CUW" - match :regex + + def regex, do: ~r/^(599)(9)(.{7})/ + def country, do: "Curaçao" + def a2, do: "CW" + def a3, do: "CUW" + + matcher :regex, ["5999"] end diff --git a/lib/phone/cy.ex b/lib/phone/cy.ex index adad70f..c30445c 100644 --- a/lib/phone/cy.ex +++ b/lib/phone/cy.ex @@ -1,8 +1,10 @@ defmodule Phone.CY do use Helper.Country - field :regex, ~r/^(357)()(.{7,8})/ - field :country, "Cyprus" - field :a2, "CY" - field :a3, "CYP" - match :regex + + def regex, do: ~r/^(357)()(.{7,8})/ + def country, do: "Cyprus" + def a2, do: "CY" + def a3, do: "CYP" + + matcher :regex, ["357"] end diff --git a/lib/phone/cz.ex b/lib/phone/cz.ex index 09b2859..bfeb11f 100644 --- a/lib/phone/cz.ex +++ b/lib/phone/cz.ex @@ -1,8 +1,10 @@ defmodule Phone.CZ do use Helper.Country - field :regex, ~r/^(420)()(.{9})/ - field :country, "Czech Republic" - field :a2, "CZ" - field :a3, "CZE" - match :regex + + def regex, do: ~r/^(420)()(.{9})/ + def country, do: "Czech Republic" + def a2, do: "CZ" + def a3, do: "CZE" + + matcher :regex, ["420"] end diff --git a/lib/phone/de.ex b/lib/phone/de.ex index 8fa19ea..ff3acf4 100644 --- a/lib/phone/de.ex +++ b/lib/phone/de.ex @@ -1,8 +1,10 @@ defmodule Phone.DE do use Helper.Country - field :regex, ~r/^(49)()(.{10,11})/ - field :country, "Germany" - field :a2, "DE" - field :a3, "DEU" - match :regex + + def regex, do: ~r/^(49)()(.{10,11})/ + def country, do: "Germany" + def a2, do: "DE" + def a3, do: "DEU" + + matcher :regex, ["49"] end diff --git a/lib/phone/dj.ex b/lib/phone/dj.ex index d04837e..69fe180 100644 --- a/lib/phone/dj.ex +++ b/lib/phone/dj.ex @@ -1,8 +1,10 @@ defmodule Phone.DJ do use Helper.Country - field :regex, ~r/^(253)()(.{8})/ - field :country, "Djibouti" - field :a2, "DJ" - field :a3, "DJI" - match :regex + + def regex, do: ~r/^(253)()(.{8})/ + def country, do: "Djibouti" + def a2, do: "DJ" + def a3, do: "DJI" + + matcher :regex, ["253"] end diff --git a/lib/phone/dk.ex b/lib/phone/dk.ex index 1962752..8403b51 100644 --- a/lib/phone/dk.ex +++ b/lib/phone/dk.ex @@ -1,8 +1,10 @@ defmodule Phone.DK do use Helper.Country - field :regex, ~r/^(45)()(.{8})/ - field :country, "Denmark" - field :a2, "DK" - field :a3, "DNK" - match :regex + + def regex, do: ~r/^(45)()(.{8})/ + def country, do: "Denmark" + def a2, do: "DK" + def a3, do: "DNK" + + matcher :regex, ["45"] end diff --git a/lib/phone/dz.ex b/lib/phone/dz.ex index 9f1d05e..b6cd92f 100644 --- a/lib/phone/dz.ex +++ b/lib/phone/dz.ex @@ -1,8 +1,10 @@ defmodule Phone.DZ do - use Helper.Country - field :regex, ~r/^(213)()(.{8})/ - field :country, "Algeria" - field :a2, "DZ" - field :a3, "DZA" - match :regex + use Helper.Country + + def regex, do: ~r/^(213)()(.{8})/ + def country, do: "Algeria" + def a2, do: "DZ" + def a3, do: "DZA" + + matcher :regex, ["213"] end diff --git a/lib/phone/ec.ex b/lib/phone/ec.ex index 701c9ab..7de7cb6 100644 --- a/lib/phone/ec.ex +++ b/lib/phone/ec.ex @@ -1,8 +1,10 @@ defmodule Phone.EC do use Helper.Country - field :regex, ~r/^(593)(..)(.{7})/ - field :country, "Ecuador" - field :a2, "EC" - field :a3, "ECU" - match :regex + + def regex, do: ~r/^(593)(..)(.{7})/ + def country, do: "Ecuador" + def a2, do: "EC" + def a3, do: "ECU" + + matcher :regex, ["593"] end diff --git a/lib/phone/ee.ex b/lib/phone/ee.ex index f88e7a7..f75a3e4 100644 --- a/lib/phone/ee.ex +++ b/lib/phone/ee.ex @@ -1,8 +1,10 @@ defmodule Phone.EE do use Helper.Country - field :regex, ~r/^(372)()(.{7,8})/ - field :country, "Estonia" - field :a2, "EE" - field :a3, "EST" - match :regex + + def regex, do: ~r/^(372)()(.{7,8})/ + def country, do: "Estonia" + def a2, do: "EE" + def a3, do: "EST" + + matcher :regex, ["372"] end diff --git a/lib/phone/eg.ex b/lib/phone/eg.ex index c43f030..170dc8d 100644 --- a/lib/phone/eg.ex +++ b/lib/phone/eg.ex @@ -1,8 +1,10 @@ defmodule Phone.EG do use Helper.Country - field :regex, ~r/^(20)()(.+)/ - field :country, "Egypt" - field :a2, "EG" - field :a3, "EGY" - match :regex + + def regex, do: ~r/^(20)()(.+)/ + def country, do: "Egypt" + def a2, do: "EG" + def a3, do: "EGY" + + matcher :regex, ["20"] end diff --git a/lib/phone/er.ex b/lib/phone/er.ex index 7de1de4..5470aa8 100644 --- a/lib/phone/er.ex +++ b/lib/phone/er.ex @@ -1,8 +1,10 @@ defmodule Phone.ER do use Helper.Country - field :regex, ~r/^(291)(.)(.{6})/ - field :country, "Eritrea" - field :a2, "ER" - field :a3, "ERI" - match :regex + + def regex, do: ~r/^(291)(.)(.{6})/ + def country, do: "Eritrea" + def a2, do: "ER" + def a3, do: "ERI" + + matcher :regex, ["291"] end diff --git a/lib/phone/es.ex b/lib/phone/es.ex index e1df317..6e36c5f 100644 --- a/lib/phone/es.ex +++ b/lib/phone/es.ex @@ -1,8 +1,10 @@ defmodule Phone.ES do use Helper.Country - field :regex, ~r/^(34)()(.{9})/ - field :country, "Spain" - field :a2, "ES" - field :a3, "ESP" - match :regex + + def regex, do: ~r/^(34)()(.{9})/ + def country, do: "Spain" + def a2, do: "ES" + def a3, do: "ESP" + + matcher :regex, ["34"] end diff --git a/lib/phone/et.ex b/lib/phone/et.ex index e1a418a..5d7703c 100644 --- a/lib/phone/et.ex +++ b/lib/phone/et.ex @@ -1,8 +1,10 @@ defmodule Phone.ET do use Helper.Country - field :regex, ~r/^(251)(..)(.{7})/ - field :country, "Ethiopia" - field :a2, "ET" - field :a3, "ETH" - match :regex + + def regex, do: ~r/^(251)(..)(.{7})/ + def country, do: "Ethiopia" + def a2, do: "ET" + def a3, do: "ETH" + + matcher :regex, ["251"] end diff --git a/lib/phone/fi.ex b/lib/phone/fi.ex index 63ac466..09ad139 100644 --- a/lib/phone/fi.ex +++ b/lib/phone/fi.ex @@ -1,8 +1,10 @@ defmodule Phone.FI do use Helper.Country - field :regex, ~r/^(358)()(.+)/ - field :country, "Finland" - field :a2, "FI" - field :a3, "FIN" - match :regex + + def regex, do: ~r/^(358)()(.+)/ + def country, do: "Finland" + def a2, do: "FI" + def a3, do: "FIN" + + matcher :regex, ["358"] end diff --git a/lib/phone/fj.ex b/lib/phone/fj.ex index 98cdf55..4e5440f 100644 --- a/lib/phone/fj.ex +++ b/lib/phone/fj.ex @@ -1,8 +1,10 @@ defmodule Phone.FJ do use Helper.Country - field :regex, ~r/^(679)()(.{7})/ - field :country, "Fiji" - field :a2, "FJ" - field :a3, "FJI" - match :regex + + def regex, do: ~r/^(679)()(.{7})/ + def country, do: "Fiji" + def a2, do: "FJ" + def a3, do: "FJI" + + matcher :regex, ["679"] end diff --git a/lib/phone/fm.ex b/lib/phone/fm.ex index 100c29d..2298dc7 100644 --- a/lib/phone/fm.ex +++ b/lib/phone/fm.ex @@ -1,8 +1,10 @@ defmodule Phone.FM do use Helper.Country - field :regex, ~r/^(691)()(.{7})/ - field :country, "Micronesia" - field :a2, "FM" - field :a3, "FSM" - match :regex + + def regex, do: ~r/^(691)()(.{7})/ + def country, do: "Micronesia" + def a2, do: "FM" + def a3, do: "FSM" + + matcher :regex, ["691"] end diff --git a/lib/phone/fo.ex b/lib/phone/fo.ex index 618440a..11fb666 100644 --- a/lib/phone/fo.ex +++ b/lib/phone/fo.ex @@ -1,8 +1,10 @@ defmodule Phone.FO do use Helper.Country - field :regex, ~r/^(298)()(.{6})/ - field :country, "Faroe Islands" - field :a2, "FO" - field :a3, "FRO" - match :regex + + def regex, do: ~r/^(298)()(.{6})/ + def country, do: "Faroe Islands" + def a2, do: "FO" + def a3, do: "FRO" + + matcher :regex, ["298"] end diff --git a/lib/phone/fr.ex b/lib/phone/fr.ex index b7d9dc7..6a4ca58 100644 --- a/lib/phone/fr.ex +++ b/lib/phone/fr.ex @@ -1,8 +1,10 @@ defmodule Phone.FR do use Helper.Country - field :regex, ~r/^(33)()(.{9})/ - field :country, "France" - field :a2, "FR" - field :a3, "FRA" - match :regex + + def regex, do: ~r/^(33)()(.{9})/ + def country, do: "France" + def a2, do: "FR" + def a3, do: "FRA" + + matcher :regex, ["33"] end diff --git a/lib/phone/ga.ex b/lib/phone/ga.ex index bddec8a..b91721e 100644 --- a/lib/phone/ga.ex +++ b/lib/phone/ga.ex @@ -1,8 +1,10 @@ defmodule Phone.GA do use Helper.Country - field :regex, ~r/^(241)()(.{7})/ - field :country, "Gabon" - field :a2, "GA" - field :a3, "GAB" - match :regex + + def regex, do: ~r/^(241)()(.{7})/ + def country, do: "Gabon" + def a2, do: "GA" + def a3, do: "GAB" + + matcher :regex, ["241"] end diff --git a/lib/phone/gb.ex b/lib/phone/gb.ex index 473734b..c4e6b16 100644 --- a/lib/phone/gb.ex +++ b/lib/phone/gb.ex @@ -1,8 +1,10 @@ defmodule Phone.GB do use Helper.Country - field :regex, ~r/^(44)()(.{10})/ - field :country, "United Kingdom" - field :a2, "GB" - field :a3, "GBR" - match :regex + + def regex, do: ~r/^(44)()(.{10})/ + def country, do: "United Kingdom" + def a2, do: "GB" + def a3, do: "GBR" + + matcher :regex, ["44"] end diff --git a/lib/phone/ge.ex b/lib/phone/ge.ex index 0145cf4..374c74b 100644 --- a/lib/phone/ge.ex +++ b/lib/phone/ge.ex @@ -1,8 +1,10 @@ defmodule Phone.GE do use Helper.Country - field :regex, ~r/^(995)(.{3})(.{6})/ - field :country, "Georgia" - field :a2, "GE" - field :a3, "GEO" - match :regex + + def regex, do: ~r/^(995)(.{3})(.{6})/ + def country, do: "Georgia" + def a2, do: "GE" + def a3, do: "GEO" + + matcher :regex, ["995"] end diff --git a/lib/phone/gf.ex b/lib/phone/gf.ex index 4a1fe57..2880ead 100644 --- a/lib/phone/gf.ex +++ b/lib/phone/gf.ex @@ -1,8 +1,10 @@ defmodule Phone.GF do use Helper.Country - field :regex, ~r/^(594)([5|6]94)(.{6})/ - field :country, "French Guiana" - field :a2, "GF" - field :a3, "GUF" - match :regex + + def regex, do: ~r/^(594)([5|6]94)(.{6})/ + def country, do: "French Guiana" + def a2, do: "GF" + def a3, do: "GUF" + + matcher :regex, ["594594", "594694"] end diff --git a/lib/phone/gh.ex b/lib/phone/gh.ex index 3277f29..e616400 100644 --- a/lib/phone/gh.ex +++ b/lib/phone/gh.ex @@ -1,8 +1,10 @@ defmodule Phone.GH do use Helper.Country - field :regex, ~r/^(233)(..)(.{7})/ - field :country, "Ghana" - field :a2, "GH" - field :a3, "GHA" - match :regex + + def regex, do: ~r/^(233)(..)(.{7})/ + def country, do: "Ghana" + def a2, do: "GH" + def a3, do: "GHA" + + matcher :regex, ["233"] end diff --git a/lib/phone/gi.ex b/lib/phone/gi.ex index fd4c2a3..554f76c 100644 --- a/lib/phone/gi.ex +++ b/lib/phone/gi.ex @@ -1,8 +1,10 @@ defmodule Phone.GI do use Helper.Country - field :regex, ~r/^(350)()(.{8})/ - field :country, "Gibraltar" - field :a2, "GI" - field :a3, "GIB" - match :regex + + def regex, do: ~r/^(350)()(.{8})/ + def country, do: "Gibraltar" + def a2, do: "GI" + def a3, do: "GIB" + + matcher :regex, ["350"] end diff --git a/lib/phone/gl.ex b/lib/phone/gl.ex index d3dd9f0..cfe7db3 100644 --- a/lib/phone/gl.ex +++ b/lib/phone/gl.ex @@ -1,8 +1,10 @@ defmodule Phone.GL do use Helper.Country - field :regex, ~r/^(299)(..)(.{4})/ - field :country, "Greenland" - field :a2, "GL" - field :a3, "GRL" - match :regex + + def regex, do: ~r/^(299)(..)(.{4})/ + def country, do: "Greenland" + def a2, do: "GL" + def a3, do: "GRL" + + matcher :regex, ["299"] end diff --git a/lib/phone/gm.ex b/lib/phone/gm.ex index 15aa902..e725ea9 100644 --- a/lib/phone/gm.ex +++ b/lib/phone/gm.ex @@ -1,8 +1,10 @@ defmodule Phone.GM do use Helper.Country - field :regex, ~r/^(220)()(.{7})/ - field :country, "Gambia" - field :a2, "GM" - field :a3, "GMB" - match :regex + + def regex, do: ~r/^(220)()(.{7})/ + def country, do: "Gambia" + def a2, do: "GM" + def a3, do: "GMB" + + matcher :regex, ["220"] end diff --git a/lib/phone/gn.ex b/lib/phone/gn.ex index c6fd28f..e9f95bc 100644 --- a/lib/phone/gn.ex +++ b/lib/phone/gn.ex @@ -1,8 +1,10 @@ defmodule Phone.GN do use Helper.Country - field :regex, ~r/^(224)()(.{8})/ - field :country, "Guinea" - field :a2, "GN" - field :a3, "GIN" - match :regex + + def regex, do: ~r/^(224)()(.{8})/ + def country, do: "Guinea" + def a2, do: "GN" + def a3, do: "GIN" + + matcher :regex, ["224"] end diff --git a/lib/phone/gq.ex b/lib/phone/gq.ex index de2696c..261540e 100644 --- a/lib/phone/gq.ex +++ b/lib/phone/gq.ex @@ -1,8 +1,10 @@ defmodule Phone.GQ do use Helper.Country - field :regex, ~r/^(240)()(.{9})/ - field :country, "Equatorial Guinea" - field :a2, "GQ" - field :a3, "GNQ" - match :regex + + def regex, do: ~r/^(240)()(.{9})/ + def country, do: "Equatorial Guinea" + def a2, do: "GQ" + def a3, do: "GNQ" + + matcher :regex, ["240"] end diff --git a/lib/phone/gr.ex b/lib/phone/gr.ex index af6260a..125f6b4 100644 --- a/lib/phone/gr.ex +++ b/lib/phone/gr.ex @@ -1,8 +1,10 @@ defmodule Phone.GR do use Helper.Country - field :regex, ~r/^(30)()(.{10})/ - field :country, "Greece" - field :a2, "GR" - field :a3, "GRC" - match :regex + + def regex, do: ~r/^(30)()(.{10})/ + def country, do: "Greece" + def a2, do: "GR" + def a3, do: "GRC" + + matcher :regex, ["30"] end diff --git a/lib/phone/gt.ex b/lib/phone/gt.ex index 2d4dba1..55df991 100644 --- a/lib/phone/gt.ex +++ b/lib/phone/gt.ex @@ -1,8 +1,10 @@ defmodule Phone.GT do use Helper.Country - field :regex, ~r/^(502)()(.{8})/ - field :country, "Guatemala" - field :a2, "GT" - field :a3, "GTM" - match :regex + + def regex, do: ~r/^(502)()(.{8})/ + def country, do: "Guatemala" + def a2, do: "GT" + def a3, do: "GTM" + + matcher :regex, ["502"] end diff --git a/lib/phone/gw.ex b/lib/phone/gw.ex index 93a8a15..cf5c2aa 100644 --- a/lib/phone/gw.ex +++ b/lib/phone/gw.ex @@ -1,8 +1,10 @@ defmodule Phone.GW do use Helper.Country - field :regex, ~r/^(245)()(.{7})/ - field :country, "Guinea-Bissau" - field :a2, "GW" - field :a3, "GNB" - match :regex + + def regex, do: ~r/^(245)()(.{7})/ + def country, do: "Guinea-Bissau" + def a2, do: "GW" + def a3, do: "GNB" + + matcher :regex, ["245"] end diff --git a/lib/phone/gy.ex b/lib/phone/gy.ex index 4597f60..e3aac0f 100644 --- a/lib/phone/gy.ex +++ b/lib/phone/gy.ex @@ -1,8 +1,10 @@ defmodule Phone.GY do use Helper.Country - field :regex, ~r/^(592)()(.{8})/ - field :country, "Guyana" - field :a2, "GY" - field :a3, "GUY" - match :regex + + def regex, do: ~r/^(592)()(.{8})/ + def country, do: "Guyana" + def a2, do: "GY" + def a3, do: "GUY" + + matcher :regex, ["592"] end diff --git a/lib/phone/hk.ex b/lib/phone/hk.ex index 0446737..012573c 100644 --- a/lib/phone/hk.ex +++ b/lib/phone/hk.ex @@ -1,8 +1,10 @@ defmodule Phone.HK do use Helper.Country - field :regex, ~r/^(852)()(.{8})/ - field :country, "Hong Kong" - field :a2, "HK" - field :a3, "HKG" - match :regex + + def regex, do: ~r/^(852)()(.{8})/ + def country, do: "Hong Kong" + def a2, do: "HK" + def a3, do: "HKG" + + matcher :regex, ["852"] end diff --git a/lib/phone/hn.ex b/lib/phone/hn.ex index bcfcc44..60461b0 100644 --- a/lib/phone/hn.ex +++ b/lib/phone/hn.ex @@ -1,8 +1,10 @@ defmodule Phone.HN do use Helper.Country - field :regex, ~r/^(504)()(.{8})/ - field :country, "Honduras" - field :a2, "HN" - field :a3, "HND" - match :regex + + def regex, do: ~r/^(504)()(.{8})/ + def country, do: "Honduras" + def a2, do: "HN" + def a3, do: "HND" + + matcher :regex, ["504"] end diff --git a/lib/phone/hr.ex b/lib/phone/hr.ex index cbffa87..aab9552 100644 --- a/lib/phone/hr.ex +++ b/lib/phone/hr.ex @@ -1,8 +1,10 @@ defmodule Phone.HR do use Helper.Country - field :regex, ~r/^(385)()(.{8,9})/ - field :country, "Croatia" - field :a2, "HR" - field :a3, "HRV" - match :regex + + def regex, do: ~r/^(385)()(.{8,9})/ + def country, do: "Croatia" + def a2, do: "HR" + def a3, do: "HRV" + + matcher :regex, ["385"] end diff --git a/lib/phone/ht.ex b/lib/phone/ht.ex index ee4fe36..b081d6d 100644 --- a/lib/phone/ht.ex +++ b/lib/phone/ht.ex @@ -1,8 +1,10 @@ defmodule Phone.HT do use Helper.Country - field :regex, ~r/^(509)()(.{8})/ - field :country, "Haiti" - field :a2, "HT" - field :a3, "HTI" - match :regex + + def regex, do: ~r/^(509)()(.{8})/ + def country, do: "Haiti" + def a2, do: "HT" + def a3, do: "HTI" + + matcher :regex, ["509"] end diff --git a/lib/phone/hu.ex b/lib/phone/hu.ex index 2bf19de..5c4a91b 100644 --- a/lib/phone/hu.ex +++ b/lib/phone/hu.ex @@ -1,8 +1,10 @@ defmodule Phone.HU do use Helper.Country - field :regex, ~r/^(36)()(.{8,9})/ - field :country, "Hungary" - field :a2, "HU" - field :a3, "HUN" - match :regex + + def regex, do: ~r/^(36)()(.{8,9})/ + def country, do: "Hungary" + def a2, do: "HU" + def a3, do: "HUN" + + matcher :regex, ["36"] end diff --git a/lib/phone/id.ex b/lib/phone/id.ex index 7da0cc2..01ac534 100644 --- a/lib/phone/id.ex +++ b/lib/phone/id.ex @@ -1,8 +1,10 @@ defmodule Phone.ID do use Helper.Country - field :regex, ~r/^(62)()(.+)/ - field :country, "Indonesia" - field :a2, "ID" - field :a3, "IDN" - match :regex + + def regex, do: ~r/^(62)()(.+)/ + def country, do: "Indonesia" + def a2, do: "ID" + def a3, do: "IDN" + + matcher :regex, ["62"] end diff --git a/lib/phone/ie.ex b/lib/phone/ie.ex index e90d80d..2c41f8a 100644 --- a/lib/phone/ie.ex +++ b/lib/phone/ie.ex @@ -1,8 +1,10 @@ defmodule Phone.IE do use Helper.Country - field :regex, ~r/^(353)(1|402|404|505|90|[2-9][1-9])(.{5,7})$/ - field :country, "Ireland" - field :a2, "IE" - field :a3, "IRL" - match :regex + + def regex, do: ~r/^(353)(1|402|404|505|90|[2-9][1-9])(.{5,7})$/ + def country, do: "Ireland" + def a2, do: "IE" + def a3, do: "IRL" + + matcher :regex, ["353"] end diff --git a/lib/phone/il.ex b/lib/phone/il.ex index 576f915..b557c9f 100644 --- a/lib/phone/il.ex +++ b/lib/phone/il.ex @@ -1,8 +1,10 @@ defmodule Phone.IL do use Helper.Country - field :regex, ~r/^(972)()(.{8,9})/ - field :country, "Israel" - field :a2, "IL" - field :a3, "ISR" - match :regex + + def regex, do: ~r/^(972)()(.{8,9})/ + def country, do: "Israel" + def a2, do: "IL" + def a3, do: "ISR" + + matcher :regex, ["972"] end diff --git a/lib/phone/in.ex b/lib/phone/in.ex index b3de600..568d6cb 100644 --- a/lib/phone/in.ex +++ b/lib/phone/in.ex @@ -1,8 +1,10 @@ defmodule Phone.IN do use Helper.Country - field :regex, ~r/^(91)()(.+)/ - field :country, "India" - field :a2, "IN" - field :a3, "IND" - match :regex + + def regex, do: ~r/^(91)()(.+)/ + def country, do: "India" + def a2, do: "IN" + def a3, do: "IND" + + matcher :regex, ["91"] end diff --git a/lib/phone/io.ex b/lib/phone/io.ex index 7487a0e..57ab6b7 100644 --- a/lib/phone/io.ex +++ b/lib/phone/io.ex @@ -1,8 +1,10 @@ defmodule Phone.IO do use Helper.Country - field :regex, ~r/^(246)() (.{7})/ - field :country, "British Indian Ocean Territory" - field :a2, "IO" - field :a3, "IOT" - match :regex + + def regex, do: ~r/^(246)() (.{7})/ + def country, do: "British Indian Ocean Territory" + def a2, do: "IO" + def a3, do: "IOT" + + matcher :regex, ["246"] end diff --git a/lib/phone/iq.ex b/lib/phone/iq.ex index 09b01cf..4795a73 100644 --- a/lib/phone/iq.ex +++ b/lib/phone/iq.ex @@ -1,8 +1,10 @@ defmodule Phone.IQ do use Helper.Country - field :regex, ~r/^(964)()(.+)/ - field :country, "Iraq" - field :a2, "IQ" - field :a3, "IRQ" - match :regex + + def regex, do: ~r/^(964)()(.+)/ + def country, do: "Iraq" + def a2, do: "IQ" + def a3, do: "IRQ" + + matcher :regex, ["964"] end diff --git a/lib/phone/ir.ex b/lib/phone/ir.ex index f92efdd..ae4c768 100644 --- a/lib/phone/ir.ex +++ b/lib/phone/ir.ex @@ -1,8 +1,10 @@ defmodule Phone.IR do use Helper.Country - field :regex, ~r/^(98)()(.+)/ - field :country, "Iran" - field :a2, "IR" - field :a3, "IRN" - match :regex + + def regex, do: ~r/^(98)()(.+)/ + def country, do: "Iran" + def a2, do: "IR" + def a3, do: "IRN" + + matcher :regex, ["98"] end diff --git a/lib/phone/is.ex b/lib/phone/is.ex index 5ed7f7f..87e4250 100644 --- a/lib/phone/is.ex +++ b/lib/phone/is.ex @@ -1,8 +1,10 @@ defmodule Phone.IS do use Helper.Country - field :regex, ~r/^(354)()(.{7})/ - field :country, "Iceland" - field :a2, "IS" - field :a3, "ISL" - match :regex + + def regex, do: ~r/^(354)()(.{7})/ + def country, do: "Iceland" + def a2, do: "IS" + def a3, do: "ISL" + + matcher :regex, ["354"] end diff --git a/lib/phone/it.ex b/lib/phone/it.ex index d8c24f3..8393b8a 100644 --- a/lib/phone/it.ex +++ b/lib/phone/it.ex @@ -1,8 +1,10 @@ defmodule Phone.IT do use Helper.Country - field :regex, ~r/^(39)()(.{9,10})/ - field :country, "Italy" - field :a2, "IT" - field :a3, "ITA" - match :regex + + def regex, do: ~r/^(39)()(.{9,10})/ + def country, do: "Italy" + def a2, do: "IT" + def a3, do: "ITA" + + matcher :regex, ["39"] end diff --git a/lib/phone/jo.ex b/lib/phone/jo.ex index c629015..a61bc2d 100644 --- a/lib/phone/jo.ex +++ b/lib/phone/jo.ex @@ -1,8 +1,10 @@ defmodule Phone.JO do use Helper.Country - field :regex, ~r/^(962)(.)(.{7,8})/ - field :country, "Jordan" - field :a2, "JO" - field :a3, "JOR" - match :regex + + def regex, do: ~r/^(962)(.)(.{7,8})/ + def country, do: "Jordan" + def a2, do: "JO" + def a3, do: "JOR" + + matcher :regex, ["962"] end diff --git a/lib/phone/jp.ex b/lib/phone/jp.ex index 28d4589..c34bad1 100644 --- a/lib/phone/jp.ex +++ b/lib/phone/jp.ex @@ -1,8 +1,10 @@ defmodule Phone.JP do use Helper.Country - field :regex, ~r/^(81)()(.+)/ - field :country, "Japan" - field :a2, "JP" - field :a3, "JPN" - match :regex + + def regex, do: ~r/^(81)()(.+)/ + def country, do: "Japan" + def a2, do: "JP" + def a3, do: "JPN" + + matcher :regex, ["81"] end diff --git a/lib/phone/ke.ex b/lib/phone/ke.ex index 1cc1015..6d3f41a 100644 --- a/lib/phone/ke.ex +++ b/lib/phone/ke.ex @@ -1,8 +1,10 @@ defmodule Phone.KE do use Helper.Country - field :regex, ~r/^(254)()(.+)/ - field :country, "Kenya" - field :a2, "KE" - field :a3, "KEN" - match :regex + + def regex, do: ~r/^(254)()(.+)/ + def country, do: "Kenya" + def a2, do: "KE" + def a3, do: "KEN" + + matcher :regex, ["254"] end diff --git a/lib/phone/kg.ex b/lib/phone/kg.ex index b73ae53..e83726a 100644 --- a/lib/phone/kg.ex +++ b/lib/phone/kg.ex @@ -1,8 +1,10 @@ defmodule Phone.KG do use Helper.Country - field :regex, ~r/^(996)()(.{9})/ - field :country, "Kyrgyzstan" - field :a2, "KG" - field :a3, "KGZ" - match :regex + + def regex, do: ~r/^(996)()(.{9})/ + def country, do: "Kyrgyzstan" + def a2, do: "KG" + def a3, do: "KGZ" + + matcher :regex, ["996"] end diff --git a/lib/phone/kh.ex b/lib/phone/kh.ex index e8f18d6..367bd5d 100644 --- a/lib/phone/kh.ex +++ b/lib/phone/kh.ex @@ -1,8 +1,10 @@ defmodule Phone.KH do use Helper.Country - field :regex, ~r/^(855)(..)(.{6,7})/ - field :country, "Cambodia" - field :a2, "KH" - field :a3, "KHM" - match :regex + + def regex, do: ~r/^(855)(..)(.{6,7})/ + def country, do: "Cambodia" + def a2, do: "KH" + def a3, do: "KHM" + + matcher :regex, ["855"] end diff --git a/lib/phone/ki.ex b/lib/phone/ki.ex index e2176fd..f30ca66 100644 --- a/lib/phone/ki.ex +++ b/lib/phone/ki.ex @@ -1,8 +1,10 @@ defmodule Phone.KI do use Helper.Country - field :regex, ~r/^(686)()(.{5})/ - field :country, "Kiribati" - field :a2, "KI" - field :a3, "KIR" - match :regex + + def regex, do: ~r/^(686)()(.{5})/ + def country, do: "Kiribati" + def a2, do: "KI" + def a3, do: "KIR" + + matcher :regex, ["686"] end diff --git a/lib/phone/km.ex b/lib/phone/km.ex index 692bc3e..ed6e3ac 100644 --- a/lib/phone/km.ex +++ b/lib/phone/km.ex @@ -1,8 +1,10 @@ defmodule Phone.KM do use Helper.Country - field :regex, ~r/^(269)(.{3})(.{4})/ - field :country, "Comoros" - field :a2, "KM" - field :a3, "COM" - match :regex + + def regex, do: ~r/^(269)(.{3})(.{4})/ + def country, do: "Comoros" + def a2, do: "KM" + def a3, do: "COM" + + matcher :regex, ["269"] end diff --git a/lib/phone/kp.ex b/lib/phone/kp.ex index bcbfce7..3e318dd 100644 --- a/lib/phone/kp.ex +++ b/lib/phone/kp.ex @@ -1,8 +1,10 @@ defmodule Phone.KP do use Helper.Country - field :regex, ~r/^(850)()(.+)/ - field :country, "North Korea" - field :a2, "KP" - field :a3, "PRK" - match :regex + + def regex, do: ~r/^(850)()(.+)/ + def country, do: "North Korea" + def a2, do: "KP" + def a3, do: "PRK" + + matcher :regex, ["850"] end diff --git a/lib/phone/kr.ex b/lib/phone/kr.ex index f875430..68d41ae 100644 --- a/lib/phone/kr.ex +++ b/lib/phone/kr.ex @@ -1,8 +1,10 @@ defmodule Phone.KR do use Helper.Country - field :regex, ~r/^(82)(.{1,2})(.{7,8})/ - field :country, "South Korea" - field :a2, "KR" - field :a3, "KOR" - match :regex + + def regex, do: ~r/^(82)(.{1,2})(.{7,8})/ + def country, do: "South Korea" + def a2, do: "KR" + def a3, do: "KOR" + + matcher :regex, ["82"] end diff --git a/lib/phone/kw.ex b/lib/phone/kw.ex index 76265aa..4061ab6 100644 --- a/lib/phone/kw.ex +++ b/lib/phone/kw.ex @@ -1,8 +1,10 @@ defmodule Phone.KW do use Helper.Country - field :regex, ~r/^(965)()(.{8})/ - field :country, "Kuwait" - field :a2, "KW" - field :a3, "KWT" - match :regex + + def regex, do: ~r/^(965)()(.{8})/ + def country, do: "Kuwait" + def a2, do: "KW" + def a3, do: "KWT" + + matcher :regex, ["965"] end diff --git a/lib/phone/kz.ex b/lib/phone/kz.ex index 7cd9365..46decbf 100644 --- a/lib/phone/kz.ex +++ b/lib/phone/kz.ex @@ -1,8 +1,10 @@ defmodule Phone.KZ do use Helper.Country - field :regex, ~r/^(7)([67]..)(.{7})/ - field :country, "Kazakhstan" - field :a2, "KZ" - field :a3, "KAZ" - match :regex + + def regex, do: ~r/^(7)([67]..)(.{7})/ + def country, do: "Kazakhstan" + def a2, do: "KZ" + def a3, do: "KAZ" + + matcher :regex, ["76", "77"] end diff --git a/lib/phone/la.ex b/lib/phone/la.ex index 5760e15..4e31bf4 100644 --- a/lib/phone/la.ex +++ b/lib/phone/la.ex @@ -1,8 +1,10 @@ defmodule Phone.LA do use Helper.Country - field :regex, ~r/^(856)(..)(.+)/ - field :country, "Laos" - field :a2, "LA" - field :a3, "LAO" - match :regex + + def regex, do: ~r/^(856)(..)(.+)/ + def country, do: "Laos" + def a2, do: "LA" + def a3, do: "LAO" + + matcher :regex, ["856"] end diff --git a/lib/phone/lb.ex b/lib/phone/lb.ex index 101773b..5131c55 100644 --- a/lib/phone/lb.ex +++ b/lib/phone/lb.ex @@ -1,8 +1,10 @@ defmodule Phone.LB do use Helper.Country - field :regex, ~r/^(961)(.{1,2})(.{6})/ - field :country, "Lebanon" - field :a2, "LB" - field :a3, "LBN" - match :regex + + def regex, do: ~r/^(961)(.{1,2})(.{6})/ + def country, do: "Lebanon" + def a2, do: "LB" + def a3, do: "LBN" + + matcher :regex, ["961"] end diff --git a/lib/phone/li.ex b/lib/phone/li.ex index ffc5fa3..f664887 100644 --- a/lib/phone/li.ex +++ b/lib/phone/li.ex @@ -1,8 +1,10 @@ defmodule Phone.LI do use Helper.Country - field :regex, ~r/^(423)()(.{7})/ - field :country, "Liechtenstein" - field :a2, "LI" - field :a3, "LIE" - match :regex + + def regex, do: ~r/^(423)()(.{7})/ + def country, do: "Liechtenstein" + def a2, do: "LI" + def a3, do: "LIE" + + matcher :regex, ["423"] end diff --git a/lib/phone/lk.ex b/lib/phone/lk.ex index 7b16e1c..c35a7c9 100644 --- a/lib/phone/lk.ex +++ b/lib/phone/lk.ex @@ -1,8 +1,10 @@ defmodule Phone.LK do use Helper.Country - field :regex, ~r/^(94)()(.{9})/ - field :country, "Sri Lanka" - field :a2, "LK" - field :a3, "LKA" - match :regex + + def regex, do: ~r/^(94)()(.{9})/ + def country, do: "Sri Lanka" + def a2, do: "LK" + def a3, do: "LKA" + + matcher :regex, ["94"] end diff --git a/lib/phone/lr.ex b/lib/phone/lr.ex index 717030c..68a87be 100644 --- a/lib/phone/lr.ex +++ b/lib/phone/lr.ex @@ -1,8 +1,10 @@ defmodule Phone.LR do use Helper.Country - field :regex, ~r/^(231)()(.{7,9})/ - field :country, "Liberia" - field :a2, "LR" - field :a3, "LBR" - match :regex + + def regex, do: ~r/^(231)()(.{7,9})/ + def country, do: "Liberia" + def a2, do: "LR" + def a3, do: "LBR" + + matcher :regex, ["231"] end diff --git a/lib/phone/ls.ex b/lib/phone/ls.ex index b444397..c011709 100644 --- a/lib/phone/ls.ex +++ b/lib/phone/ls.ex @@ -1,8 +1,10 @@ defmodule Phone.LS do use Helper.Country - field :regex, ~r/^(266)(..)(.{6})/ - field :country, "Lesotho" - field :a2, "LS" - field :a3, "LSO" - match :regex + + def regex, do: ~r/^(266)(..)(.{6})/ + def country, do: "Lesotho" + def a2, do: "LS" + def a3, do: "LSO" + + matcher :regex, ["266"] end diff --git a/lib/phone/lt.ex b/lib/phone/lt.ex index 8b313f3..c87ee8d 100644 --- a/lib/phone/lt.ex +++ b/lib/phone/lt.ex @@ -1,8 +1,10 @@ defmodule Phone.LT do use Helper.Country - field :regex, ~r/^(370)()(.{8})/ - field :country, "Lithuania" - field :a2, "LT" - field :a3, "LTU" - match :regex + + def regex, do: ~r/^(370)()(.{8})/ + def country, do: "Lithuania" + def a2, do: "LT" + def a3, do: "LTU" + + matcher :regex, ["370"] end diff --git a/lib/phone/lu.ex b/lib/phone/lu.ex index 4ea67c8..78460da 100644 --- a/lib/phone/lu.ex +++ b/lib/phone/lu.ex @@ -1,8 +1,10 @@ defmodule Phone.LU do use Helper.Country - field :regex, ~r/^(352)()(.+)/ - field :country, "Luxembourg" - field :a2, "LU" - field :a3, "LUX" - match :regex + + def regex, do: ~r/^(352)()(.+)/ + def country, do: "Luxembourg" + def a2, do: "LU" + def a3, do: "LUX" + + matcher :regex, ["352"] end diff --git a/lib/phone/lv.ex b/lib/phone/lv.ex index 4ac547e..6549c0f 100644 --- a/lib/phone/lv.ex +++ b/lib/phone/lv.ex @@ -1,8 +1,10 @@ defmodule Phone.LV do use Helper.Country - field :regex, ~r/^(371)()(.{8})/ - field :country, "Latvia" - field :a2, "LV" - field :a3, "LVA" - match :regex + + def regex, do: ~r/^(371)()(.{8})/ + def country, do: "Latvia" + def a2, do: "LV" + def a3, do: "LVA" + + matcher :regex, ["371"] end diff --git a/lib/phone/ly.ex b/lib/phone/ly.ex index 16bdbeb..850782a 100644 --- a/lib/phone/ly.ex +++ b/lib/phone/ly.ex @@ -1,8 +1,10 @@ defmodule Phone.LY do use Helper.Country - field :regex, ~r/^(218)()(.+)/ - field :country, "Libya" - field :a2, "LY" - field :a3, "LBY" - match :regex + + def regex, do: ~r/^(218)()(.+)/ + def country, do: "Libya" + def a2, do: "LY" + def a3, do: "LBY" + + matcher :regex, ["218"] end diff --git a/lib/phone/ma.ex b/lib/phone/ma.ex index 082ee92..922522d 100644 --- a/lib/phone/ma.ex +++ b/lib/phone/ma.ex @@ -1,8 +1,10 @@ defmodule Phone.MA do use Helper.Country - field :regex, ~r/^(212)()(.{9})/ - field :country, "Morocco" - field :a2, "MA" - field :a3, "MAR" - match :regex + + def regex, do: ~r/^(212)()(.{9})/ + def country, do: "Morocco" + def a2, do: "MA" + def a3, do: "MAR" + + matcher :regex, ["212"] end diff --git a/lib/phone/mc.ex b/lib/phone/mc.ex index 4e0ac4f..a591400 100644 --- a/lib/phone/mc.ex +++ b/lib/phone/mc.ex @@ -1,8 +1,10 @@ defmodule Phone.MC do use Helper.Country - field :regex, ~r/^(377)()(.{9})/ - field :country, "Monaco" - field :a2, "MC" - field :a3, "MCO" - match :regex + + def regex, do: ~r/^(377)()(.{9})/ + def country, do: "Monaco" + def a2, do: "MC" + def a3, do: "MCO" + + matcher :regex, ["377"] end diff --git a/lib/phone/md.ex b/lib/phone/md.ex index adb44d3..0f941ac 100644 --- a/lib/phone/md.ex +++ b/lib/phone/md.ex @@ -1,8 +1,10 @@ defmodule Phone.MD do use Helper.Country - field :regex, ~r/^(373)()(.{8})/ - field :country, "Moldova" - field :a2, "MD" - field :a3, "MDA" - match :regex + + def regex, do: ~r/^(373)()(.{8})/ + def country, do: "Moldova" + def a2, do: "MD" + def a3, do: "MDA" + + matcher :regex, ["373"] end diff --git a/lib/phone/me.ex b/lib/phone/me.ex index 80404ad..0caa741 100644 --- a/lib/phone/me.ex +++ b/lib/phone/me.ex @@ -1,8 +1,10 @@ defmodule Phone.ME do use Helper.Country - field :regex, ~r/^(382)(..)(.{6})/ - field :country, "Montenegro" - field :a2, "ME" - field :a3, "MNE" - match :regex + + def regex, do: ~r/^(382)(..)(.{6})/ + def country, do: "Montenegro" + def a2, do: "ME" + def a3, do: "MNE" + + matcher :regex, ["382"] end diff --git a/lib/phone/mg.ex b/lib/phone/mg.ex index 635d7b9..39f8d7a 100644 --- a/lib/phone/mg.ex +++ b/lib/phone/mg.ex @@ -1,8 +1,10 @@ defmodule Phone.MG do use Helper.Country - field :regex, ~r/^(261)()(.+)/ - field :country, "Madagascar" - field :a2, "MG" - field :a3, "MDG" - match :regex + + def regex, do: ~r/^(261)()(.+)/ + def country, do: "Madagascar" + def a2, do: "MG" + def a3, do: "MDG" + + matcher :regex, ["261"] end diff --git a/lib/phone/mh.ex b/lib/phone/mh.ex index f46b3f7..704222a 100644 --- a/lib/phone/mh.ex +++ b/lib/phone/mh.ex @@ -1,8 +1,10 @@ defmodule Phone.MH do use Helper.Country - field :regex, ~r/^(692)()(.{6,7})/ - field :country, "Marshall Islands" - field :a2, "MH" - field :a3, "MHL" - match :regex + + def regex, do: ~r/^(692)()(.{6,7})/ + def country, do: "Marshall Islands" + def a2, do: "MH" + def a3, do: "MHL" + + matcher :regex, ["692"] end diff --git a/lib/phone/mk.ex b/lib/phone/mk.ex index 34a7ae7..809cf53 100644 --- a/lib/phone/mk.ex +++ b/lib/phone/mk.ex @@ -1,8 +1,10 @@ defmodule Phone.MK do use Helper.Country - field :regex, ~r/^(389)()(.{8})/ - field :country, "Macedonia" - field :a2, "MK" - field :a3, "MKD" - match :regex + + def regex, do: ~r/^(389)()(.{8})/ + def country, do: "Macedonia" + def a2, do: "MK" + def a3, do: "MKD" + + matcher :regex, ["389"] end diff --git a/lib/phone/ml.ex b/lib/phone/ml.ex index 953f164..d4be089 100644 --- a/lib/phone/ml.ex +++ b/lib/phone/ml.ex @@ -1,8 +1,10 @@ defmodule Phone.ML do use Helper.Country - field :regex, ~r/^(223)()(.{8})/ - field :country, "Mali" - field :a2, "ML" - field :a3, "MLI" - match :regex + + def regex, do: ~r/^(223)()(.{8})/ + def country, do: "Mali" + def a2, do: "ML" + def a3, do: "MLI" + + matcher :regex, ["223"] end diff --git a/lib/phone/mm.ex b/lib/phone/mm.ex index aac2f22..d6432ea 100644 --- a/lib/phone/mm.ex +++ b/lib/phone/mm.ex @@ -1,8 +1,10 @@ defmodule Phone.MM do use Helper.Country - field :regex, ~r/^(95)()(.{7,10})/ - field :country, "Myanmar" - field :a2, "MM" - field :a3, "MMR" - match :regex + + def regex, do: ~r/^(95)()(.{7,10})/ + def country, do: "Myanmar" + def a2, do: "MM" + def a3, do: "MMR" + + matcher :regex, ["95"] end diff --git a/lib/phone/mn.ex b/lib/phone/mn.ex index 074cb58..aa4c091 100644 --- a/lib/phone/mn.ex +++ b/lib/phone/mn.ex @@ -1,8 +1,10 @@ defmodule Phone.MN do use Helper.Country - field :regex, ~r/^(976)()(.+)/ - field :country, "Mongolia" - field :a2, "MN" - field :a3, "MNG" - match :regex + + def regex, do: ~r/^(976)()(.+)/ + def country, do: "Mongolia" + def a2, do: "MN" + def a3, do: "MNG" + + matcher :regex, ["976"] end diff --git a/lib/phone/mo.ex b/lib/phone/mo.ex index 895293e..7242c51 100644 --- a/lib/phone/mo.ex +++ b/lib/phone/mo.ex @@ -1,8 +1,10 @@ defmodule Phone.MO do use Helper.Country - field :regex, ~r/^(853)()(.{8})/ - field :country, "Macao" - field :a2, "MO" - field :a3, "MAC" - match :regex + + def regex, do: ~r/^(853)()(.{8})/ + def country, do: "Macao" + def a2, do: "MO" + def a3, do: "MAC" + + matcher :regex, ["853"] end diff --git a/lib/phone/mq.ex b/lib/phone/mq.ex index 026d61f..6f52afa 100644 --- a/lib/phone/mq.ex +++ b/lib/phone/mq.ex @@ -1,8 +1,10 @@ defmodule Phone.MQ do use Helper.Country - field :regex, ~r/^(596)([5|6]96)(.{6})/ - field :country, "Martinique" - field :a2, "MQ" - field :a3, "MTQ" - match :regex + + def regex, do: ~r/^(596)([5|6]96)(.{6})/ + def country, do: "Martinique" + def a2, do: "MQ" + def a3, do: "MTQ" + + matcher :regex, ["596596", "596696"] end diff --git a/lib/phone/mr.ex b/lib/phone/mr.ex index 2e11990..8fd825b 100644 --- a/lib/phone/mr.ex +++ b/lib/phone/mr.ex @@ -1,8 +1,10 @@ defmodule Phone.MR do use Helper.Country - field :regex, ~r/^(222)()(.{8})/ - field :country, "Mauritania" - field :a2, "MR" - field :a3, "MRT" - match :regex + + def regex, do: ~r/^(222)()(.{8})/ + def country, do: "Mauritania" + def a2, do: "MR" + def a3, do: "MRT" + + matcher :regex, ["222"] end diff --git a/lib/phone/mt.ex b/lib/phone/mt.ex index 4f8d04e..d7e4785 100644 --- a/lib/phone/mt.ex +++ b/lib/phone/mt.ex @@ -1,8 +1,10 @@ defmodule Phone.MT do use Helper.Country - field :regex, ~r/^(356)()(.{8})/ - field :country, "Malta" - field :a2, "MT" - field :a3, "MLT" - match :regex + + def regex, do: ~r/^(356)()(.{8})/ + def country, do: "Malta" + def a2, do: "MT" + def a3, do: "MLT" + + matcher :regex, ["356"] end diff --git a/lib/phone/mu.ex b/lib/phone/mu.ex index fab122f..35c9964 100644 --- a/lib/phone/mu.ex +++ b/lib/phone/mu.ex @@ -1,8 +1,10 @@ defmodule Phone.MU do use Helper.Country - field :regex, ~r/^(230)()(.{8})/ - field :country, "Mauritius" - field :a2, "MU" - field :a3, "MUS" - match :regex + + def regex, do: ~r/^(230)()(.{8})/ + def country, do: "Mauritius" + def a2, do: "MU" + def a3, do: "MUS" + + matcher :regex, ["230"] end diff --git a/lib/phone/mv.ex b/lib/phone/mv.ex index 9a136a6..92875a6 100644 --- a/lib/phone/mv.ex +++ b/lib/phone/mv.ex @@ -1,8 +1,10 @@ defmodule Phone.MV do use Helper.Country - field :regex, ~r/^(960)()(.{7})/ - field :country, "Maldives" - field :a2, "MV" - field :a3, "MDV" - match :regex + + def regex, do: ~r/^(960)()(.{7})/ + def country, do: "Maldives" + def a2, do: "MV" + def a3, do: "MDV" + + matcher :regex, ["960"] end diff --git a/lib/phone/mw.ex b/lib/phone/mw.ex index 5778130..340443f 100644 --- a/lib/phone/mw.ex +++ b/lib/phone/mw.ex @@ -1,8 +1,10 @@ defmodule Phone.MW do use Helper.Country - field :regex, ~r/^(265)()(.{7,9})/ - field :country, "Malawi" - field :a2, "MW" - field :a3, "MWI" - match :regex + + def regex, do: ~r/^(265)()(.{7,9})/ + def country, do: "Malawi" + def a2, do: "MW" + def a3, do: "MWI" + + matcher :regex, ["265"] end diff --git a/lib/phone/mx.ex b/lib/phone/mx.ex index 3c10e71..b01f907 100644 --- a/lib/phone/mx.ex +++ b/lib/phone/mx.ex @@ -1,8 +1,10 @@ defmodule Phone.MX do use Helper.Country - field :regex, ~r/^(52)()(.{10})/ - field :country, "Mexico" - field :a2, "MX" - field :a3, "MEX" - match :regex + + def regex, do: ~r/^(52)()(.{10})/ + def country, do: "Mexico" + def a2, do: "MX" + def a3, do: "MEX" + + matcher :regex, ["52"] end diff --git a/lib/phone/my.ex b/lib/phone/my.ex index 8651490..0154d60 100644 --- a/lib/phone/my.ex +++ b/lib/phone/my.ex @@ -1,8 +1,10 @@ defmodule Phone.MY do use Helper.Country - field :regex, ~r/^(60)()(.+)/ - field :country, "Malaysia" - field :a2, "MY" - field :a3, "MYS" - match :regex + + def regex, do: ~r/^(60)()(.+)/ + def country, do: "Malaysia" + def a2, do: "MY" + def a3, do: "MYS" + + matcher :regex, ["60"] end diff --git a/lib/phone/mz.ex b/lib/phone/mz.ex index b63231b..f5bb938 100644 --- a/lib/phone/mz.ex +++ b/lib/phone/mz.ex @@ -1,8 +1,10 @@ defmodule Phone.MZ do use Helper.Country - field :regex, ~r/^(258)()(.+)/ - field :country, "Mozambique" - field :a2, "MZ" - field :a3, "MOZ" - match :regex + + def regex, do: ~r/^(258)()(.+)/ + def country, do: "Mozambique" + def a2, do: "MZ" + def a3, do: "MOZ" + + matcher :regex, ["258"] end diff --git a/lib/phone/na.ex b/lib/phone/na.ex index f0c7cc9..742ec42 100644 --- a/lib/phone/na.ex +++ b/lib/phone/na.ex @@ -1,8 +1,10 @@ defmodule Phone.NA do use Helper.Country - field :regex, ~r/^(264)()(.+)/ - field :country, "Namibia" - field :a2, "NA" - field :a3, "NAM" - match :regex + + def regex, do: ~r/^(264)()(.+)/ + def country, do: "Namibia" + def a2, do: "NA" + def a3, do: "NAM" + + matcher :regex, ["264"] end diff --git a/lib/phone/nanp.ex b/lib/phone/nanp.ex index f6e361f..553c30a 100644 --- a/lib/phone/nanp.ex +++ b/lib/phone/nanp.ex @@ -1,32 +1,11 @@ defmodule Phone.NANP do use Helper.Country - field :modules, [ - Phone.NANP.AS, - Phone.NANP.AI, - Phone.NANP.AG, - Phone.NANP.BS, - Phone.NANP.BB, - Phone.NANP.BM, - Phone.NANP.CA, - Phone.NANP.DM, - Phone.NANP.DO, - Phone.NANP.GD, - Phone.NANP.GU, - Phone.NANP.JM, - Phone.NANP.KN, - Phone.NANP.KY, - Phone.NANP.LC, - Phone.NANP.MP, - Phone.NANP.MS, - Phone.NANP.PR, - Phone.NANP.SX, - Phone.NANP.TC, - Phone.NANP.TT, - Phone.NANP.US, - Phone.NANP.VC, - Phone.NANP.VG, - Phone.NANP.VI, - Phone.NANP.TollFree - ] - match :modules + + matcher :modules, [Phone.NANP.AS, Phone.NANP.AI, Phone.NANP.AG, Phone.NANP.BS, + Phone.NANP.BB, Phone.NANP.BM, Phone.NANP.CA, Phone.NANP.DM, + Phone.NANP.DO, Phone.NANP.GD, Phone.NANP.GU, Phone.NANP.JM, + Phone.NANP.KN, Phone.NANP.KY, Phone.NANP.LC, Phone.NANP.MP, + Phone.NANP.MS, Phone.NANP.PR, Phone.NANP.SX, Phone.NANP.TC, + Phone.NANP.TT, Phone.NANP.US, Phone.NANP.VC, Phone.NANP.VG, + Phone.NANP.VI, Phone.NANP.TollFree] end diff --git a/lib/phone/nanp/ag.ex b/lib/phone/nanp/ag.ex index 5601513..e9ec040 100644 --- a/lib/phone/nanp/ag.ex +++ b/lib/phone/nanp/ag.ex @@ -1,8 +1,10 @@ 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 + + def regex, do: ~r/^(1)(268)([2-9].{6})$/ + def country, do: "Antigua and Barbuda" + def a2, do: "AG" + def a3, do: "ATG" + + matcher :regex, ["1268"] end diff --git a/lib/phone/nanp/ai.ex b/lib/phone/nanp/ai.ex index 163e3b0..ca7614f 100644 --- a/lib/phone/nanp/ai.ex +++ b/lib/phone/nanp/ai.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.AI do use Helper.Country - field :regex, ~r/^(1)(264)([2-9].{6})$/ - field :country, "Anguilla" - field :a2, "AI" - field :a3, "AIA" - match :regex + + def regex, do: ~r/^(1)(264)([2-9].{6})$/ + def country, do: "Anguilla" + def a2, do: "AI" + def a3, do: "AIA" + + matcher :regex, ["1264"] end diff --git a/lib/phone/nanp/as.ex b/lib/phone/nanp/as.ex index ead5907..f11f19a 100644 --- a/lib/phone/nanp/as.ex +++ b/lib/phone/nanp/as.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.AS do use Helper.Country - field :regex, ~r/^(1)(684)([2-9].{6})$/ - field :country, "American Samoa" - field :a2, "AS" - field :a3, "ASM" - match :regex + + def regex, do: ~r/^(1)(684)([2-9].{6})$/ + def country, do: "American Samoa" + def a2, do: "AS" + def a3, do: "ASM" + + matcher :regex, ["1684"] end diff --git a/lib/phone/nanp/bb.ex b/lib/phone/nanp/bb.ex index 519f203..8b33453 100644 --- a/lib/phone/nanp/bb.ex +++ b/lib/phone/nanp/bb.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.BB do use Helper.Country - field :regex, ~r/^(1)(246)([2-9].{6})$/ - field :country, "Barbados" - field :a2, "BB" - field :a3, "BRB" - match :regex + + def regex, do: ~r/^(1)(246)([2-9].{6})$/ + def country, do: "Barbados" + def a2, do: "BB" + def a3, do: "BRB" + + matcher :regex, ["1246"] end diff --git a/lib/phone/nanp/bm.ex b/lib/phone/nanp/bm.ex index ee8c66d..fdd6c92 100644 --- a/lib/phone/nanp/bm.ex +++ b/lib/phone/nanp/bm.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.BM do use Helper.Country - field :regex, ~r/^(1)(441)([2-9].{6})$/ - field :country, "Bermuda" - field :a2, "BM" - field :a3, "BMU" - match :regex + + def regex, do: ~r/^(1)(441)([2-9].{6})$/ + def country, do: "Bermuda" + def a2, do: "BM" + def a3, do: "BMU" + + matcher :regex, ["1441"] end diff --git a/lib/phone/nanp/bs.ex b/lib/phone/nanp/bs.ex index 8c82d1f..efde0c0 100644 --- a/lib/phone/nanp/bs.ex +++ b/lib/phone/nanp/bs.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.BS do use Helper.Country - field :regex, ~r/^(1)(242)([2-9].{6})$/ - field :country, "Bahamas" - field :a2, "BS" - field :a3, "BHS" - match :regex + + def regex, do: ~r/^(1)(242)([2-9].{6})$/ + def country, do: "Bahamas" + def a2, do: "BS" + def a3, do: "BHS" + + matcher :regex, ["1242"] end diff --git a/lib/phone/nanp/ca.ex b/lib/phone/nanp/ca.ex index 68d6449..de22db5 100644 --- a/lib/phone/nanp/ca.ex +++ b/lib/phone/nanp/ca.ex @@ -1,19 +1,12 @@ 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 + + def country, do: "Canada" + def a2, do: "CA" + def a3, do: "CAN" + + matcher :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] end diff --git a/lib/phone/nanp/ca/ab.ex b/lib/phone/nanp/ca/ab.ex index 2b35238..7a6cf5c 100644 --- a/lib/phone/nanp/ca/ab.ex +++ b/lib/phone/nanp/ca/ab.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.CA.AB do use Helper.Area - field :regex, ~r/^(1)(403|780|587|825)([2-9].{6})$/ - field :area_name, "Alberta" - field :area_type, "province" - field :area_abbreviation, "AB" - builder() + + def regex, do: ~r/^(1)(403|780|587|825)([2-9].{6})$/ + def area_name, do: "Alberta" + def area_type, do: "province" + def area_abbreviation, do: "AB" + + matcher ["1403", "1780", "1587", "1825"] end diff --git a/lib/phone/nanp/ca/bc.ex b/lib/phone/nanp/ca/bc.ex index 4dcb025..3297472 100644 --- a/lib/phone/nanp/ca/bc.ex +++ b/lib/phone/nanp/ca/bc.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.CA.BC do use Helper.Area - field :regex, ~r/^(1)(604|778|236|250)([2-9].{6})$/ - field :area_name, "British Columbia" - field :area_type, "province" - field :area_abbreviation, "BC" - builder() + + def regex, do: ~r/^(1)(604|778|236|250)([2-9].{6})$/ + def area_name, do: "British Columbia" + def area_type, do: "province" + def area_abbreviation, do: "BC" + + matcher ["1604", "1778", "1236", "1250"] end diff --git a/lib/phone/nanp/ca/mb.ex b/lib/phone/nanp/ca/mb.ex index 19072b4..d30bc6b 100644 --- a/lib/phone/nanp/ca/mb.ex +++ b/lib/phone/nanp/ca/mb.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.CA.MB do use Helper.Area - field :regex, ~r/^(1)(204|431)([2-9].{6})$/ - field :area_name, "Manitoba" - field :area_type, "province" - field :area_abbreviation, "MB" - builder() + + def regex, do: ~r/^(1)(204|431)([2-9].{6})$/ + def area_name, do: "Manitoba" + def area_type, do: "province" + def area_abbreviation, do: "MB" + + matcher ["1204", "1431"] end diff --git a/lib/phone/nanp/ca/nb.ex b/lib/phone/nanp/ca/nb.ex index 25c4219..64f07f6 100644 --- a/lib/phone/nanp/ca/nb.ex +++ b/lib/phone/nanp/ca/nb.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.CA.NB do use Helper.Area - field :regex, ~r/^(1)(506)([2-9].{6})$/ - field :area_name, "New Brunswick" - field :area_type, "province" - field :area_abbreviation, "NB" - builder() + + def regex, do: ~r/^(1)(506)([2-9].{6})$/ + def area_name, do: "New Brunswick" + def area_type, do: "province" + def area_abbreviation, do: "NB" + + matcher ["1506"] end diff --git a/lib/phone/nanp/ca/nl.ex b/lib/phone/nanp/ca/nl.ex index 0d8137d..5242506 100644 --- a/lib/phone/nanp/ca/nl.ex +++ b/lib/phone/nanp/ca/nl.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.CA.NL do use Helper.Area - field :regex, ~r/^(1)(709)([2-9].{6})$/ - field :area_name, "Newfoundland and Labrador" - field :area_type, "province" - field :area_abbreviation, "NL" - builder() + + def regex, do: ~r/^(1)(709)([2-9].{6})$/ + def area_name, do: "Newfoundland and Labrador" + def area_type, do: "province" + def area_abbreviation, do: "NL" + + matcher ["1709"] end diff --git a/lib/phone/nanp/ca/ns_pe.ex b/lib/phone/nanp/ca/ns_pe.ex index 3f964b6..dc58600 100644 --- a/lib/phone/nanp/ca/ns_pe.ex +++ b/lib/phone/nanp/ca/ns_pe.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.CA.NS_PE do use Helper.Area - field :regex, ~r/^(1)(902|782)([2-9].{6})$/ - field :area_name, ["Nova Scotia","Prince Edward Island"] - field :area_type, "provinces" - field :area_abbreviation, ["NS","PE"] - builder() + + def regex, do: ~r/^(1)(902|782)([2-9].{6})$/ + def area_name, do: ["Nova Scotia","Prince Edward Island"] + def area_type, do: "provinces" + def area_abbreviation, do: ["NS","PE"] + + matcher ["1902", "1782"] end diff --git a/lib/phone/nanp/ca/on.ex b/lib/phone/nanp/ca/on.ex index 0612670..3abd256 100644 --- a/lib/phone/nanp/ca/on.ex +++ b/lib/phone/nanp/ca/on.ex @@ -1,8 +1,11 @@ defmodule Phone.NANP.CA.ON do use Helper.Area - field :regex, ~r/^(1)(226|249|289|343|365|416|437|519|548|613|647|705|807|905)([2-9].{6})$/ - field :area_name, "Ontario" - field :area_type, "province" - field :area_abbreviation, "ON" - builder() + + def regex, do: ~r/^(1)(226|249|289|343|365|416|437|519|548|613|647|705|807|905)([2-9].{6})$/ + def area_name, do: "Ontario" + def area_type, do: "province" + def area_abbreviation, do: "ON" + + matcher ["1226", "1249", "1289", "1343", "1365", "1416", "1437", "1519", "1548", + "1613", "1647", "1705", "1807", "1905"] end diff --git a/lib/phone/nanp/ca/qc.ex b/lib/phone/nanp/ca/qc.ex index e94a6d0..bb4e9b7 100644 --- a/lib/phone/nanp/ca/qc.ex +++ b/lib/phone/nanp/ca/qc.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.CA.QC do use Helper.Area - field :regex, ~r/^(1)(418|438|450|514|579|581|819|873)([2-9].{6})$/ - field :area_name, "Quebec" - field :area_type, "province" - field :area_abbreviation, "QC" - builder() + + def regex, do: ~r/^(1)(418|438|450|514|579|581|819|873)([2-9].{6})$/ + def area_name, do: "Quebec" + def area_type, do: "province" + def area_abbreviation, do: "QC" + + matcher ["1418", "1438", "1450", "1514", "1579", "1581", "1819", "1873"] end diff --git a/lib/phone/nanp/ca/sk.ex b/lib/phone/nanp/ca/sk.ex index 6baf2cf..6719026 100644 --- a/lib/phone/nanp/ca/sk.ex +++ b/lib/phone/nanp/ca/sk.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.CA.SK do use Helper.Area - field :regex, ~r/^(1)(306|639)([2-9].{6})$/ - field :area_name, "Saskatchewan" - field :area_type, "province" - field :area_abbreviation, "SK" - builder() + + def regex, do: ~r/^(1)(306|639)([2-9].{6})$/ + def area_name, do: "Saskatchewan" + def area_type, do: "province" + def area_abbreviation, do: "SK" + + matcher ["1306", "1639"] end diff --git a/lib/phone/nanp/ca/territory.ex b/lib/phone/nanp/ca/territory.ex index 5967a32..5c8b6d1 100644 --- a/lib/phone/nanp/ca/territory.ex +++ b/lib/phone/nanp/ca/territory.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.CA.Territory do use Helper.Area - field :regex, ~r/^(1)(867)([2-9].{6})$/ - field :area_name, ["Northwest Territories", "Nunavut", "Yukon"] - field :area_type, "territories" - field :area_abbreviation, ["NT","NU","YT"] - builder() + + def regex, do: ~r/^(1)(867)([2-9].{6})$/ + def area_name, do: ["Northwest Territories", "Nunavut", "Yukon"] + def area_type, do: "territories" + def area_abbreviation, do: ["NT","NU","YT"] + + matcher ["1867"] end diff --git a/lib/phone/nanp/dm.ex b/lib/phone/nanp/dm.ex index 0fe1730..9053189 100644 --- a/lib/phone/nanp/dm.ex +++ b/lib/phone/nanp/dm.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.DM do use Helper.Country - field :regex, ~r/^(1)(767)([2-9].{6})$/ - field :country, "Dominica" - field :a2, "DM" - field :a3, "DMA" - match :regex + + def regex, do: ~r/^(1)(767)([2-9].{6})$/ + def country, do: "Dominica" + def a2, do: "DM" + def a3, do: "DMA" + + matcher :regex, ["1767"] end diff --git a/lib/phone/nanp/do.ex b/lib/phone/nanp/do.ex index d9aaf69..bbc47ac 100644 --- a/lib/phone/nanp/do.ex +++ b/lib/phone/nanp/do.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.DO do use Helper.Country - field :regex, ~r/^(1)(8[0|2|4]9)([2-9].{6})$/ - field :country, "Dominican Republic" - field :a2, "DO" - field :a3, "DOM" - match :regex + + def regex, do: ~r/^(1)(8[0|2|4]9)([2-9].{6})$/ + def country, do: "Dominican Republic" + def a2, do: "DO" + def a3, do: "DOM" + + matcher :regex, ["1809", "1829", "1849"] end diff --git a/lib/phone/nanp/gd.ex b/lib/phone/nanp/gd.ex index 9baf64c..0116a0a 100644 --- a/lib/phone/nanp/gd.ex +++ b/lib/phone/nanp/gd.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.GD do use Helper.Country - field :regex, ~r/^(1)(473)([2-9].{6})$/ - field :country, "Grenada" - field :a2, "GD" - field :a3, "GRD" - match :regex + + def regex, do: ~r/^(1)(473)([2-9].{6})$/ + def country, do: "Grenada" + def a2, do: "GD" + def a3, do: "GRD" + + matcher :regex, ["1473"] end diff --git a/lib/phone/nanp/gu.ex b/lib/phone/nanp/gu.ex index ddea34a..4fc27e1 100644 --- a/lib/phone/nanp/gu.ex +++ b/lib/phone/nanp/gu.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.GU do use Helper.Country - field :regex, ~r/^(1)(671)([2-9].{6})$/ - field :country, "Guam" - field :a2, "GU" - field :a3, "GUM" - match :regex + + def regex, do: ~r/^(1)(671)([2-9].{6})$/ + def country, do: "Guam" + def a2, do: "GU" + def a3, do: "GUM" + + matcher :regex, ["1671"] end diff --git a/lib/phone/nanp/jm.ex b/lib/phone/nanp/jm.ex index 9947f28..87d76d4 100644 --- a/lib/phone/nanp/jm.ex +++ b/lib/phone/nanp/jm.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.JM do use Helper.Country - field :regex, ~r/^(1)(876)([2-9].{6})$/ - field :country, "Jamaica" - field :a2, "JA" - field :a3, "JAM" - match :regex + + def regex, do: ~r/^(1)(876)([2-9].{6})$/ + def country, do: "Jamaica" + def a2, do: "JA" + def a3, do: "JAM" + + matcher :regex, ["1876"] end diff --git a/lib/phone/nanp/kn.ex b/lib/phone/nanp/kn.ex index 3db04e5..c30e3e1 100644 --- a/lib/phone/nanp/kn.ex +++ b/lib/phone/nanp/kn.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.KN do use Helper.Country - field :regex, ~r/^(1)(869)([2-9].{6})$/ - field :country, "Saint Kitts and Nevis" - field :a2, "KN" - field :a3, "KNA" - match :regex + + def regex, do: ~r/^(1)(869)([2-9].{6})$/ + def country, do: "Saint Kitts and Nevis" + def a2, do: "KN" + def a3, do: "KNA" + + matcher :regex, ["1869"] end diff --git a/lib/phone/nanp/ky.ex b/lib/phone/nanp/ky.ex index a56c65d..de14dec 100644 --- a/lib/phone/nanp/ky.ex +++ b/lib/phone/nanp/ky.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.KY do use Helper.Country - field :regex, ~r/^(1)(345)([2-9].{6})$/ - field :country, "Cayman Islands" - field :a2, "KY" - field :a3, "CYM" - match :regex + + def regex, do: ~r/^(1)(345)([2-9].{6})$/ + def country, do: "Cayman Islands" + def a2, do: "KY" + def a3, do: "CYM" + + matcher :regex, ["1345"] end diff --git a/lib/phone/nanp/lc.ex b/lib/phone/nanp/lc.ex index 0c19fd4..20d36ce 100644 --- a/lib/phone/nanp/lc.ex +++ b/lib/phone/nanp/lc.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.LC do use Helper.Country - field :regex, ~r/^(1)(758)([2-9].{6})$/ - field :country, "Saint Lucia" - field :a2, "LC" - field :a3, "LCA" - match :regex + + def regex, do: ~r/^(1)(758)([2-9].{6})$/ + def country, do: "Saint Lucia" + def a2, do: "LC" + def a3, do: "LCA" + + matcher :regex, ["1758"] end diff --git a/lib/phone/nanp/mp.ex b/lib/phone/nanp/mp.ex index e60e96a..a507e40 100644 --- a/lib/phone/nanp/mp.ex +++ b/lib/phone/nanp/mp.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.MP do use Helper.Country - field :regex, ~r/^(1)(670)([2-9].{6})$/ - field :country, "Northern Mariana Islands" - field :a2, "MP" - field :a3, "MNP" - match :regex + + def regex, do: ~r/^(1)(670)([2-9].{6})$/ + def country, do: "Northern Mariana Islands" + def a2, do: "MP" + def a3, do: "MNP" + + matcher :regex, ["1670"] end diff --git a/lib/phone/nanp/ms.ex b/lib/phone/nanp/ms.ex index 6e63bfc..dc6fee1 100644 --- a/lib/phone/nanp/ms.ex +++ b/lib/phone/nanp/ms.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.MS do use Helper.Country - field :regex, ~r/^(1)(664)([2-9].{6})$/ - field :country, "Montserrat" - field :a2, "MS" - field :a3, "MSR" - match :regex + + def regex, do: ~r/^(1)(664)([2-9].{6})$/ + def country, do: "Montserrat" + def a2, do: "MS" + def a3, do: "MSR" + + matcher :regex, ["1664"] end diff --git a/lib/phone/nanp/pr.ex b/lib/phone/nanp/pr.ex index 035b337..550c96c 100644 --- a/lib/phone/nanp/pr.ex +++ b/lib/phone/nanp/pr.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.PR do use Helper.Country - field :regex, ~r/^(1)(787|939)([2-9].{6})$/ - field :country, "Puerto Rico" - field :a2, "PR" - field :a3, "PRI" - match :regex + + def regex, do: ~r/^(1)(787|939)([2-9].{6})$/ + def country, do: "Puerto Rico" + def a2, do: "PR" + def a3, do: "PRI" + + matcher :regex, ["1787", "1939"] end diff --git a/lib/phone/nanp/sx.ex b/lib/phone/nanp/sx.ex index d740dd3..3be381d 100644 --- a/lib/phone/nanp/sx.ex +++ b/lib/phone/nanp/sx.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.SX do use Helper.Country - field :regex, ~r/^(1)(721)([2-9].{6})$/ - field :country, "Sint Maarten" - field :a2, "SX" - field :a3, "SXM" - match :regex + + def regex, do: ~r/^(1)(721)([2-9].{6})$/ + def country, do: "Sint Maarten" + def a2, do: "SX" + def a3, do: "SXM" + + matcher :regex, ["1721"] end diff --git a/lib/phone/nanp/tc.ex b/lib/phone/nanp/tc.ex index 91e2462..0b508b4 100644 --- a/lib/phone/nanp/tc.ex +++ b/lib/phone/nanp/tc.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.TC do use Helper.Country - field :regex, ~r/^(1)(649)([2-9].{6})$/ - field :country, "Turks and Caicos Islands" - field :a2, "TC" - field :a3, "TCA" - match :regex + + def regex, do: ~r/^(1)(649)([2-9].{6})$/ + def country, do: "Turks and Caicos Islands" + def a2, do: "TC" + def a3, do: "TCA" + + matcher :regex, ["1649"] end diff --git a/lib/phone/nanp/toll_free.ex b/lib/phone/nanp/toll_free.ex index 3ce596b..7c9d0f0 100644 --- a/lib/phone/nanp/toll_free.ex +++ b/lib/phone/nanp/toll_free.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.TollFree do use Helper.Country - field :regex, ~r/^(1)(800|844|855|866|877|888)([2-9].{6})$/ - field :country, "NANP tool-free" - field :a2, "" - field :a3, "" - match :regex + + def regex, do: ~r/^(1)(800|844|855|866|877|888)([2-9].{6})$/ + def country, do: "NANP tool-free" + def a2, do: "" + def a3, do: "" + + matcher :regex, ["1800", "1844", "1855", "1866", "1877", "1888"] end diff --git a/lib/phone/nanp/tt.ex b/lib/phone/nanp/tt.ex index 049333b..bb50309 100644 --- a/lib/phone/nanp/tt.ex +++ b/lib/phone/nanp/tt.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.TT do use Helper.Country - field :regex, ~r/^(1)(868)([2-9].{6})$/ - field :country, "Trinidad and Tobago" - field :a2, "TT" - field :a3, "TTO" - match :regex + + def regex, do: ~r/^(1)(868)([2-9].{6})$/ + def country, do: "Trinidad and Tobago" + def a2, do: "TT" + def a3, do: "TTO" + + matcher :regex, ["1868"] end diff --git a/lib/phone/nanp/us.ex b/lib/phone/nanp/us.ex index 3c4b9cf..55f3c62 100644 --- a/lib/phone/nanp/us.ex +++ b/lib/phone/nanp/us.ex @@ -1,60 +1,21 @@ defmodule Phone.NANP.US do use Helper.Country - field :country, "United States" - field :a2, "US" - field :a3, "USA" - field :modules, [ - Phone.NANP.US.AK, - Phone.NANP.US.AL, - Phone.NANP.US.AR, - Phone.NANP.US.AZ, - Phone.NANP.US.CA, - Phone.NANP.US.CO, - Phone.NANP.US.CT, - Phone.NANP.US.DC, - Phone.NANP.US.DE, - Phone.NANP.US.FL, - Phone.NANP.US.GA, - Phone.NANP.US.HI, - Phone.NANP.US.IA, - Phone.NANP.US.ID, - Phone.NANP.US.IL, - Phone.NANP.US.IN, - Phone.NANP.US.KS, - Phone.NANP.US.KY, - Phone.NANP.US.LA, - Phone.NANP.US.MA, - Phone.NANP.US.MD, - Phone.NANP.US.ME, - Phone.NANP.US.MI, - Phone.NANP.US.MN, - Phone.NANP.US.MO, - Phone.NANP.US.MS, - Phone.NANP.US.MT, - Phone.NANP.US.NC, - Phone.NANP.US.ND, - Phone.NANP.US.NE, - Phone.NANP.US.NH, - Phone.NANP.US.NJ, - Phone.NANP.US.NM, - Phone.NANP.US.NV, - Phone.NANP.US.NY, - Phone.NANP.US.OH, - Phone.NANP.US.OK, - Phone.NANP.US.OR, - Phone.NANP.US.PA, - Phone.NANP.US.RI, - Phone.NANP.US.SC, - Phone.NANP.US.SD, - Phone.NANP.US.TN, - Phone.NANP.US.TX, - Phone.NANP.US.UT, - Phone.NANP.US.VT, - Phone.NANP.US.VA, - Phone.NANP.US.WA, - Phone.NANP.US.WI, - Phone.NANP.US.WV, - Phone.NANP.US.WY - ] - match :modules + + def country, do: "United States" + def a2, do: "US" + def a3, do: "USA" + + matcher :modules, [Phone.NANP.US.AK, Phone.NANP.US.AL, Phone.NANP.US.AR, Phone.NANP.US.AZ, + Phone.NANP.US.CA, Phone.NANP.US.CO, Phone.NANP.US.CT, Phone.NANP.US.DC, + Phone.NANP.US.DE, Phone.NANP.US.FL, Phone.NANP.US.GA, Phone.NANP.US.HI, + Phone.NANP.US.IA, Phone.NANP.US.ID, Phone.NANP.US.IL, Phone.NANP.US.IN, + Phone.NANP.US.KS, Phone.NANP.US.KY, Phone.NANP.US.LA, Phone.NANP.US.MA, + Phone.NANP.US.MD, Phone.NANP.US.ME, Phone.NANP.US.MI, Phone.NANP.US.MN, + Phone.NANP.US.MO, Phone.NANP.US.MS, Phone.NANP.US.MT, Phone.NANP.US.NC, + Phone.NANP.US.ND, Phone.NANP.US.NE, Phone.NANP.US.NH, Phone.NANP.US.NJ, + Phone.NANP.US.NM, Phone.NANP.US.NV, Phone.NANP.US.NY, Phone.NANP.US.OH, + Phone.NANP.US.OK, Phone.NANP.US.OR, Phone.NANP.US.PA, Phone.NANP.US.RI, + Phone.NANP.US.SC, Phone.NANP.US.SD, Phone.NANP.US.TN, Phone.NANP.US.TX, + Phone.NANP.US.UT, Phone.NANP.US.VT, Phone.NANP.US.VA, Phone.NANP.US.WA, + Phone.NANP.US.WI, Phone.NANP.US.WV, Phone.NANP.US.WY] end diff --git a/lib/phone/nanp/us/ak.ex b/lib/phone/nanp/us/ak.ex index 6a1a006..5d1727b 100644 --- a/lib/phone/nanp/us/ak.ex +++ b/lib/phone/nanp/us/ak.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.AK do use Helper.Area - field :regex, ~r/^(1)(907)([2-9].{6})$/ - field :area_name, "Alaska" - field :area_type, "state" - field :area_abbreviation, "AK" - builder() + + def regex, do: ~r/^(1)(907)([2-9].{6})$/ + def area_name, do: "Alaska" + def area_type, do: "state" + def area_abbreviation, do: "AK" + + matcher ["1907"] end diff --git a/lib/phone/nanp/us/al.ex b/lib/phone/nanp/us/al.ex index 9ed55e6..e6369c1 100644 --- a/lib/phone/nanp/us/al.ex +++ b/lib/phone/nanp/us/al.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.AL do use Helper.Area - field :regex, ~r/^(1)(205|251|256|334|938)([2-9].{6})$/ - field :area_name, "Alabama" - field :area_type, "state" - field :area_abbreviation, "AL" - builder() + + def regex, do: ~r/^(1)(205|251|256|334|938)([2-9].{6})$/ + def area_name, do: "Alabama" + def area_type, do: "state" + def area_abbreviation, do: "AL" + + matcher ["1205", "1251", "1256", "1334", "1938"] end diff --git a/lib/phone/nanp/us/ar.ex b/lib/phone/nanp/us/ar.ex index 7587e02..972216d 100644 --- a/lib/phone/nanp/us/ar.ex +++ b/lib/phone/nanp/us/ar.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.AR do use Helper.Area - field :regex, ~r/^(1)(479|501|870)([2-9].{6})$/ - field :area_name, "Arkansas" - field :area_type, "state" - field :area_abbreviation, "AR" - builder() + + def regex, do: ~r/^(1)(479|501|870)([2-9].{6})$/ + def area_name, do: "Arkansas" + def area_type, do: "state" + def area_abbreviation, do: "AR" + + matcher ["1479", "1501", "1870"] end diff --git a/lib/phone/nanp/us/az.ex b/lib/phone/nanp/us/az.ex index b7864f7..cf381cf 100644 --- a/lib/phone/nanp/us/az.ex +++ b/lib/phone/nanp/us/az.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.AZ do use Helper.Area - field :regex, ~r/^(1)(480|520|602|623|928)([2-9].{6})$/ - field :area_name, "Arizona" - field :area_type, "state" - field :area_abbreviation, "AZ" - builder() + + def regex, do: ~r/^(1)(480|520|602|623|928)([2-9].{6})$/ + def area_name, do: "Arizona" + def area_type, do: "state" + def area_abbreviation, do: "AZ" + + matcher ["1480", "1520", "1602", "1623", "1928"] end diff --git a/lib/phone/nanp/us/ca.ex b/lib/phone/nanp/us/ca.ex index 34ec70f..5638837 100644 --- a/lib/phone/nanp/us/ca.ex +++ b/lib/phone/nanp/us/ca.ex @@ -1,8 +1,13 @@ defmodule Phone.NANP.US.CA do use Helper.Area - field :regex, ~r/^(1)(209|213|310|323|408|415|424|442|510|530|559|562|619|626|628|650|657|661|669|707|714|747|760|805|818|831|858|909|916|925|949|951)([2-9].{6})$/ - field :area_name, "California" - field :area_type, "state" - field :area_abbreviation, "CA" - builder() + + def regex, do: ~r/^(1)(209|213|310|323|408|415|424|442|510|530|559|562|619|626|628|650|657|661|669|707|714|747|760|805|818|831|858|909|916|925|949|951)([2-9].{6})$/ + def area_name, do: "California" + def area_type, do: "state" + def area_abbreviation, do: "CA" + + matcher ["1209", "1213", "1310", "1323", "1408", "1415", "1424", "1442", "1510", + "1530", "1559", "1562", "1619", "1626", "1628", "1650", "1657", "1661", + "1669", "1707", "1714", "1747", "1760", "1805", "1818", "1831", "1858", + "1909", "1916", "1925", "1949", "1951"] end diff --git a/lib/phone/nanp/us/co.ex b/lib/phone/nanp/us/co.ex index eb70e8a..d562f3f 100644 --- a/lib/phone/nanp/us/co.ex +++ b/lib/phone/nanp/us/co.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.CO do use Helper.Area - field :regex, ~r/^(1)(303|719|720|970)([2-9].{6})$/ - field :area_name, "Colorado" - field :area_type, "state" - field :area_abbreviation, "CO" - builder() + + def regex, do: ~r/^(1)(303|719|720|970)([2-9].{6})$/ + def area_name, do: "Colorado" + def area_type, do: "state" + def area_abbreviation, do: "CO" + + matcher ["1303", "1719", "1720", "1970"] end diff --git a/lib/phone/nanp/us/ct.ex b/lib/phone/nanp/us/ct.ex index 7f34101..03e00e9 100644 --- a/lib/phone/nanp/us/ct.ex +++ b/lib/phone/nanp/us/ct.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.CT do use Helper.Area - field :regex, ~r/^(1)(203|475|860|959)([2-9].{6})$/ - field :area_name, "Connecticut" - field :area_type, "state" - field :area_abbreviation, "CT" - builder() + + def regex, do: ~r/^(1)(203|475|860|959)([2-9].{6})$/ + def area_name, do: "Connecticut" + def area_type, do: "state" + def area_abbreviation, do: "CT" + + matcher ["1203", "1475", "1860", "1959"] end diff --git a/lib/phone/nanp/us/dc.ex b/lib/phone/nanp/us/dc.ex index 7123dee..6cf23ea 100644 --- a/lib/phone/nanp/us/dc.ex +++ b/lib/phone/nanp/us/dc.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.DC do use Helper.Area - field :regex, ~r/^(1)(202)([2-9].{6})$/ - field :area_name, "Washington, D.C." - field :area_type, "state" - field :area_abbreviation, "DC" - builder() + + def regex, do: ~r/^(1)(202)([2-9].{6})$/ + def area_name, do: "Washington, D.C." + def area_type, do: "state" + def area_abbreviation, do: "DC" + + matcher ["1202"] end diff --git a/lib/phone/nanp/us/de.ex b/lib/phone/nanp/us/de.ex index 2291111..8c23739 100644 --- a/lib/phone/nanp/us/de.ex +++ b/lib/phone/nanp/us/de.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.DE do use Helper.Area - field :regex, ~r/^(1)(302)([2-9].{6})$/ - field :area_name, "Delaware" - field :area_type, "state" - field :area_abbreviation, "DE" - builder() + + def regex, do: ~r/^(1)(302)([2-9].{6})$/ + def area_name, do: "Delaware" + def area_type, do: "state" + def area_abbreviation, do: "DE" + + matcher ["1302"] end diff --git a/lib/phone/nanp/us/fl.ex b/lib/phone/nanp/us/fl.ex index 30dec0c..2e15975 100644 --- a/lib/phone/nanp/us/fl.ex +++ b/lib/phone/nanp/us/fl.ex @@ -1,8 +1,11 @@ defmodule Phone.NANP.US.FL do use Helper.Area - field :regex, ~r/^(1)(239|305|321|352|386|407|561|727|754|772|786|813|850|863|904|941|954)([2-9].{6})$/ - field :area_name, "Florida" - field :area_type, "state" - field :area_abbreviation, "FL" - builder() + + def regex, do: ~r/^(1)(239|305|321|352|386|407|561|727|754|772|786|813|850|863|904|941|954)([2-9].{6})$/ + def area_name, do: "Florida" + def area_type, do: "state" + def area_abbreviation, do: "FL" + + matcher ["1239", "1305", "1321", "1352", "1386", "1407", "1561", "1727", "1754", + "1772", "1786", "1813", "1850", "1863", "1904", "1941", "1954"] end diff --git a/lib/phone/nanp/us/ga.ex b/lib/phone/nanp/us/ga.ex index bb50a63..922cf1f 100644 --- a/lib/phone/nanp/us/ga.ex +++ b/lib/phone/nanp/us/ga.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.GA do use Helper.Area - field :regex, ~r/^(1)(229|404|470|478|678|706|762|770|912)([2-9].{6})$/ - field :area_name, "Georgia" - field :area_type, "state" - field :area_abbreviation, "GA" - builder() + + def regex, do: ~r/^(1)(229|404|470|478|678|706|762|770|912)([2-9].{6})$/ + def area_name, do: "Georgia" + def area_type, do: "state" + def area_abbreviation, do: "GA" + + matcher ["1229", "1404", "1470", "1478", "1678", "1706", "1762", "1770", "1912"] end diff --git a/lib/phone/nanp/us/hi.ex b/lib/phone/nanp/us/hi.ex index 1bddfe1..d93492b 100644 --- a/lib/phone/nanp/us/hi.ex +++ b/lib/phone/nanp/us/hi.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.HI do use Helper.Area - field :regex, ~r/^(1)(808)([2-9].{6})$/ - field :area_name, "Hawaii" - field :area_type, "state" - field :area_abbreviation, "HI" - builder() + + def regex, do: ~r/^(1)(808)([2-9].{6})$/ + def area_name, do: "Hawaii" + def area_type, do: "state" + def area_abbreviation, do: "HI" + + matcher ["1808"] end diff --git a/lib/phone/nanp/us/ia.ex b/lib/phone/nanp/us/ia.ex index abc6804..9f020f3 100644 --- a/lib/phone/nanp/us/ia.ex +++ b/lib/phone/nanp/us/ia.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.IA do use Helper.Area - field :regex, ~r/^(1)(319|515|563|641|712)([2-9].{6})$/ - field :area_name, "Iowa" - field :area_type, "state" - field :area_abbreviation, "IA" - builder() + + def regex, do: ~r/^(1)(319|515|563|641|712)([2-9].{6})$/ + def area_name, do: "Iowa" + def area_type, do: "state" + def area_abbreviation, do: "IA" + + matcher ["1319", "1515", "1563", "1641", "1712"] end diff --git a/lib/phone/nanp/us/id.ex b/lib/phone/nanp/us/id.ex index 11e8df6..f2dc07d 100644 --- a/lib/phone/nanp/us/id.ex +++ b/lib/phone/nanp/us/id.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.ID do use Helper.Area - field :regex, ~r/^(1)(208)([2-9].{6})$/ - field :area_name, "Idaho" - field :area_type, "state" - field :area_abbreviation, "ID" - builder() + + def regex, do: ~r/^(1)(208)([2-9].{6})$/ + def area_name, do: "Idaho" + def area_type, do: "state" + def area_abbreviation, do: "ID" + + matcher ["1208"] end diff --git a/lib/phone/nanp/us/il.ex b/lib/phone/nanp/us/il.ex index 72869df..1a481e0 100644 --- a/lib/phone/nanp/us/il.ex +++ b/lib/phone/nanp/us/il.ex @@ -1,8 +1,11 @@ defmodule Phone.NANP.US.IL do use Helper.Area - field :regex, ~r/^(1)(217|224|309|312|331|618|630|708|773|779|815|847|872)([2-9].{6})$/ - field :area_name, "Illinois" - field :area_type, "state" - field :area_abbreviation, "IL" - builder() + + def regex, do: ~r/^(1)(217|224|309|312|331|618|630|708|773|779|815|847|872)([2-9].{6})$/ + def area_name, do: "Illinois" + def area_type, do: "state" + def area_abbreviation, do: "IL" + + matcher ["1217", "1224", "1309", "1312", "1331", "1618", "1630", "1708", "1773", + "1779", "1815", "1847", "1872"] end diff --git a/lib/phone/nanp/us/in.ex b/lib/phone/nanp/us/in.ex index 1a5c32c..dd75fe5 100644 --- a/lib/phone/nanp/us/in.ex +++ b/lib/phone/nanp/us/in.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.IN do use Helper.Area - field :regex, ~r/^(1)(219|260|317|463|574|765|812|930)([2-9].{6})$/ - field :area_name, "Indiana" - field :area_type, "state" - field :area_abbreviation, "IN" - builder() + + def regex, do: ~r/^(1)(219|260|317|463|574|765|812|930)([2-9].{6})$/ + def area_name, do: "Indiana" + def area_type, do: "state" + def area_abbreviation, do: "IN" + + matcher ["1219", "1260", "1317", "1463", "1574", "1765", "1812", "1930"] end diff --git a/lib/phone/nanp/us/ks.ex b/lib/phone/nanp/us/ks.ex index 0746f6b..ed69b45 100644 --- a/lib/phone/nanp/us/ks.ex +++ b/lib/phone/nanp/us/ks.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.KS do use Helper.Area - field :regex, ~r/^(1)(316|620|785|913)([2-9].{6})$/ - field :area_name, "Kansas" - field :area_type, "state" - field :area_abbreviation, "KS" - builder() + + def regex, do: ~r/^(1)(316|620|785|913)([2-9].{6})$/ + def area_name, do: "Kansas" + def area_type, do: "state" + def area_abbreviation, do: "KS" + + matcher ["1316", "1620", "1785", "1913"] end diff --git a/lib/phone/nanp/us/ky.ex b/lib/phone/nanp/us/ky.ex index b89e2f5..69da1cf 100644 --- a/lib/phone/nanp/us/ky.ex +++ b/lib/phone/nanp/us/ky.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.KY do use Helper.Area - field :regex, ~r/^(1)(270|364|502|606|859)([2-9].{6})$/ - field :area_name, "Kentucky" - field :area_type, "state" - field :area_abbreviation, "KY" - builder() + + def regex, do: ~r/^(1)(270|364|502|606|859)([2-9].{6})$/ + def area_name, do: "Kentucky" + def area_type, do: "state" + def area_abbreviation, do: "KY" + + matcher ["1270", "1364", "1502", "1606", "1859"] end diff --git a/lib/phone/nanp/us/la.ex b/lib/phone/nanp/us/la.ex index a33ea78..a2d9530 100644 --- a/lib/phone/nanp/us/la.ex +++ b/lib/phone/nanp/us/la.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.LA do use Helper.Area - field :regex, ~r/^(1)(225|318|337|504|985)([2-9].{6})$/ - field :area_name, "Louisiana" - field :area_type, "state" - field :area_abbreviation, "LA" - builder() + + def regex, do: ~r/^(1)(225|318|337|504|985)([2-9].{6})$/ + def area_name, do: "Louisiana" + def area_type, do: "state" + def area_abbreviation, do: "LA" + + matcher ["1225", "1318", "1337", "1504", "1985"] end diff --git a/lib/phone/nanp/us/ma.ex b/lib/phone/nanp/us/ma.ex index e5d149e..cfb1a9e 100644 --- a/lib/phone/nanp/us/ma.ex +++ b/lib/phone/nanp/us/ma.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.MA do use Helper.Area - field :regex, ~r/^(1)(339|351|413|508|617|774|781|857|978)([2-9].{6})$/ - field :area_name, "Massachusetts" - field :area_type, "state" - field :area_abbreviation, "MA" - builder() + + def regex, do: ~r/^(1)(339|351|413|508|617|774|781|857|978)([2-9].{6})$/ + def area_name, do: "Massachusetts" + def area_type, do: "state" + def area_abbreviation, do: "MA" + + matcher ["1339", "1351", "1413", "1508", "1617", "1774", "1781", "1857", "1978"] end diff --git a/lib/phone/nanp/us/md.ex b/lib/phone/nanp/us/md.ex index 11e91e9..330a0e6 100644 --- a/lib/phone/nanp/us/md.ex +++ b/lib/phone/nanp/us/md.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.MD do use Helper.Area - field :regex, ~r/^(1)(240|301|410|443|667)([2-9].{6})$/ - field :area_name, "Maryland" - field :area_type, "state" - field :area_abbreviation, "MD" - builder() + + def regex, do: ~r/^(1)(240|301|410|443|667)([2-9].{6})$/ + def area_name, do: "Maryland" + def area_type, do: "state" + def area_abbreviation, do: "MD" + + matcher ["1240", "1301", "1410", "1443", "1667"] end diff --git a/lib/phone/nanp/us/me.ex b/lib/phone/nanp/us/me.ex index 8111d9a..48610ed 100644 --- a/lib/phone/nanp/us/me.ex +++ b/lib/phone/nanp/us/me.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.ME do use Helper.Area - field :regex, ~r/^(1)(207)([2-9].{6})$/ - field :area_name, "Maine" - field :area_type, "state" - field :area_abbreviation, "ME" - builder() + + def regex, do: ~r/^(1)(207)([2-9].{6})$/ + def area_name, do: "Maine" + def area_type, do: "state" + def area_abbreviation, do: "ME" + + matcher ["1207"] end diff --git a/lib/phone/nanp/us/mi.ex b/lib/phone/nanp/us/mi.ex index 44604cd..57ce080 100644 --- a/lib/phone/nanp/us/mi.ex +++ b/lib/phone/nanp/us/mi.ex @@ -1,8 +1,11 @@ defmodule Phone.NANP.US.MI do use Helper.Area - field :regex, ~r/^(1)(231|248|269|313|517|586|616|734|810|906|947|989)([2-9].{6})$/ - field :area_name, "Michigan" - field :area_type, "state" - field :area_abbreviation, "MI" - builder() + + def regex, do: ~r/^(1)(231|248|269|313|517|586|616|734|810|906|947|989)([2-9].{6})$/ + def area_name, do: "Michigan" + def area_type, do: "state" + def area_abbreviation, do: "MI" + + matcher ["1231", "1248", "1269", "1313", "1517", "1586", "1616", "1734", "1810", + "1906", "1947", "1989"] end diff --git a/lib/phone/nanp/us/mn.ex b/lib/phone/nanp/us/mn.ex index 56cdcbf..cf40b69 100644 --- a/lib/phone/nanp/us/mn.ex +++ b/lib/phone/nanp/us/mn.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.MN do use Helper.Area - field :regex, ~r/^(1)(218|320|507|612|651|763|952)([2-9].{6})$/ - field :area_name, "Minnesota" - field :area_type, "state" - field :area_abbreviation, "MN" - builder() + + def regex, do: ~r/^(1)(218|320|507|612|651|763|952)([2-9].{6})$/ + def area_name, do: "Minnesota" + def area_type, do: "state" + def area_abbreviation, do: "MN" + + matcher ["1218", "1320", "1507", "1612", "1651", "1763", "1952"] end diff --git a/lib/phone/nanp/us/mo.ex b/lib/phone/nanp/us/mo.ex index cbf4b0f..77e37c8 100644 --- a/lib/phone/nanp/us/mo.ex +++ b/lib/phone/nanp/us/mo.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.MO do use Helper.Area - field :regex, ~r/^(1)(314|417|573|636|660|816)([2-9].{6})$/ - field :area_name, "Missouri" - field :area_type, "state" - field :area_abbreviation, "MO" - builder() + + def regex, do: ~r/^(1)(314|417|573|636|660|816)([2-9].{6})$/ + def area_name, do: "Missouri" + def area_type, do: "state" + def area_abbreviation, do: "MO" + + matcher ["1314", "1417", "1573", "1636", "1660", "1816"] end diff --git a/lib/phone/nanp/us/ms.ex b/lib/phone/nanp/us/ms.ex index 8bab8eb..0adc7d9 100644 --- a/lib/phone/nanp/us/ms.ex +++ b/lib/phone/nanp/us/ms.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.MS do use Helper.Area - field :regex, ~r/^(1)(228|601|662|769)([2-9].{6})$/ - field :area_name, "Mississippi" - field :area_type, "state" - field :area_abbreviation, "MS" - builder() + + def regex, do: ~r/^(1)(228|601|662|769)([2-9].{6})$/ + def area_name, do: "Mississippi" + def area_type, do: "state" + def area_abbreviation, do: "MS" + + matcher ["1228", "1601", "1662", "1769"] end diff --git a/lib/phone/nanp/us/mt.ex b/lib/phone/nanp/us/mt.ex index f10b18e..62b92ae 100644 --- a/lib/phone/nanp/us/mt.ex +++ b/lib/phone/nanp/us/mt.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.MT do use Helper.Area - field :regex, ~r/^(1)(406)([2-9].{6})$/ - field :area_name, "Montana" - field :area_type, "state" - field :area_abbreviation, "MT" - builder() + + def regex, do: ~r/^(1)(406)([2-9].{6})$/ + def area_name, do: "Montana" + def area_type, do: "state" + def area_abbreviation, do: "MT" + + matcher ["1406"] end diff --git a/lib/phone/nanp/us/nc.ex b/lib/phone/nanp/us/nc.ex index ec7476c..8d291cc 100644 --- a/lib/phone/nanp/us/nc.ex +++ b/lib/phone/nanp/us/nc.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.NC do use Helper.Area - field :regex, ~r/^(1)(252|336|704|743|828|910|919|980|984)([2-9].{6})$/ - field :area_name, "North Carolina" - field :area_type, "state" - field :area_abbreviation, "NC" - builder() + + def regex, do: ~r/^(1)(252|336|704|743|828|910|919|980|984)([2-9].{6})$/ + def area_name, do: "North Carolina" + def area_type, do: "state" + def area_abbreviation, do: "NC" + + matcher ["1252", "1336", "1704", "1743", "1828", "1910", "1919", "1980", "1984"] end diff --git a/lib/phone/nanp/us/nd.ex b/lib/phone/nanp/us/nd.ex index ba22a9d..1aba866 100644 --- a/lib/phone/nanp/us/nd.ex +++ b/lib/phone/nanp/us/nd.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.ND do use Helper.Area - field :regex, ~r/^(1)(701)([2-9].{6})$/ - field :area_name, "North Dakota" - field :area_type, "state" - field :area_abbreviation, "ND" - builder() + + def regex, do: ~r/^(1)(701)([2-9].{6})$/ + def area_name, do: "North Dakota" + def area_type, do: "state" + def area_abbreviation, do: "ND" + + matcher ["1701"] end diff --git a/lib/phone/nanp/us/ne.ex b/lib/phone/nanp/us/ne.ex index 8f28733..a1357f8 100644 --- a/lib/phone/nanp/us/ne.ex +++ b/lib/phone/nanp/us/ne.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.NE do use Helper.Area - field :regex, ~r/^(1)(308|402|531)([2-9].{6})$/ - field :area_name, "Nebraska" - field :area_type, "state" - field :area_abbreviation, "NE" - builder() + + def regex, do: ~r/^(1)(308|402|531)([2-9].{6})$/ + def area_name, do: "Nebraska" + def area_type, do: "state" + def area_abbreviation, do: "NE" + + matcher ["1308", "1402", "1531"] end diff --git a/lib/phone/nanp/us/nh.ex b/lib/phone/nanp/us/nh.ex index a68b944..5b64676 100644 --- a/lib/phone/nanp/us/nh.ex +++ b/lib/phone/nanp/us/nh.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.NH do use Helper.Area - field :regex, ~r/^(1)(603)([2-9].{6})$/ - field :area_name, "New Hampshire" - field :area_type, "state" - field :area_abbreviation, "NH" - builder() + + def regex, do: ~r/^(1)(603)([2-9].{6})$/ + def area_name, do: "New Hampshire" + def area_type, do: "state" + def area_abbreviation, do: "NH" + + matcher ["1603"] end diff --git a/lib/phone/nanp/us/nj.ex b/lib/phone/nanp/us/nj.ex index 76930fd..fa5d247 100644 --- a/lib/phone/nanp/us/nj.ex +++ b/lib/phone/nanp/us/nj.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.NJ do use Helper.Area - field :regex, ~r/^(1)(201|551|609|732|848|856|862|908|973)([2-9].{6})$/ - field :area_name, "New Jersey" - field :area_type, "state" - field :area_abbreviation, "NJ" - builder() + + def regex, do: ~r/^(1)(201|551|609|732|848|856|862|908|973)([2-9].{6})$/ + def area_name, do: "New Jersey" + def area_type, do: "state" + def area_abbreviation, do: "NJ" + + matcher ["1201", "1551", "1609", "1732", "1848", "1856", "1862", "1908", "1973"] end diff --git a/lib/phone/nanp/us/nm.ex b/lib/phone/nanp/us/nm.ex index 0b6db3b..09a6af9 100644 --- a/lib/phone/nanp/us/nm.ex +++ b/lib/phone/nanp/us/nm.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.NM do use Helper.Area - field :regex, ~r/^(1)(5[0|7]5)([2-9].{6})$/ - field :area_name, "New Mexico" - field :area_type, "state" - field :area_abbreviation, "NM" - builder() + + def regex, do: ~r/^(1)(5[0|7]5)([2-9].{6})$/ + def area_name, do: "New Mexico" + def area_type, do: "state" + def area_abbreviation, do: "NM" + + matcher ["1505", "1575"] end diff --git a/lib/phone/nanp/us/nv.ex b/lib/phone/nanp/us/nv.ex index de7f4b4..b46fcdd 100644 --- a/lib/phone/nanp/us/nv.ex +++ b/lib/phone/nanp/us/nv.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.NV do use Helper.Area - field :regex, ~r/^(1)(702|7[2|7]5)([2-9].{6})$/ - field :area_name, "Nevada" - field :area_type, "state" - field :area_abbreviation, "NV" - builder() + + def regex, do: ~r/^(1)(702|7[2|7]5)([2-9].{6})$/ + def area_name, do: "Nevada" + def area_type, do: "state" + def area_abbreviation, do: "NV" + + matcher ["1702", "1725", "1775"] end diff --git a/lib/phone/nanp/us/ny.ex b/lib/phone/nanp/us/ny.ex index cd60b8d..ba4d1ff 100644 --- a/lib/phone/nanp/us/ny.ex +++ b/lib/phone/nanp/us/ny.ex @@ -1,8 +1,11 @@ defmodule Phone.NANP.US.NY do use Helper.Area - field :regex, ~r/^(1)(212|315|332|347|516|518|585|607|631|646|680|716|718|845|914|917|929|934)([2-9].{6})$/ - field :area_name, "New York" - field :area_type, "state" - field :area_abbreviation, "NY" - builder() + + def regex, do: ~r/^(1)(212|315|332|347|516|518|585|607|631|646|680|716|718|845|914|917|929|934)([2-9].{6})$/ + def area_name, do: "New York" + def area_type, do: "state" + def area_abbreviation, do: "NY" + + matcher ["1212", "1315", "1332", "1347", "1516", "1518", "1585", "1607", "1631", + "1646", "1680", "1716", "1718", "1845", "1914", "1917", "1929", "1934"] end diff --git a/lib/phone/nanp/us/oh.ex b/lib/phone/nanp/us/oh.ex index 6f3306d..bb38f89 100644 --- a/lib/phone/nanp/us/oh.ex +++ b/lib/phone/nanp/us/oh.ex @@ -1,8 +1,11 @@ defmodule Phone.NANP.US.OH do use Helper.Area - field :regex, ~r/^(1)(216|220|234|330|380|419|440|513|567|614|740|937)([2-9].{6})$/ - field :area_name, "Ohio" - field :area_type, "state" - field :area_abbreviation, "OH" - builder() + + def regex, do: ~r/^(1)(216|220|234|330|380|419|440|513|567|614|740|937)([2-9].{6})$/ + def area_name, do: "Ohio" + def area_type, do: "state" + def area_abbreviation, do: "OH" + + matcher ["1216", "1220", "1234", "1330", "1380", "1419", "1440", "1513", "1567", + "1614", "1740", "1937"] end diff --git a/lib/phone/nanp/us/ok.ex b/lib/phone/nanp/us/ok.ex index 01732b0..7c979f3 100644 --- a/lib/phone/nanp/us/ok.ex +++ b/lib/phone/nanp/us/ok.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.OK do use Helper.Area - field :regex, ~r/^(1)(405|539|580|918)([2-9].{6})$/ - field :area_name, "Oklahoma" - field :area_type, "state" - field :area_abbreviation, "OK" - builder() + + def regex, do: ~r/^(1)(405|539|580|918)([2-9].{6})$/ + def area_name, do: "Oklahoma" + def area_type, do: "state" + def area_abbreviation, do: "OK" + + matcher ["1405", "1539", "1580", "1918"] end diff --git a/lib/phone/nanp/us/or.ex b/lib/phone/nanp/us/or.ex index 70c7d25..2cc6ff8 100644 --- a/lib/phone/nanp/us/or.ex +++ b/lib/phone/nanp/us/or.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.OR do use Helper.Area - field :regex, ~r/^(1)(458|503|541|971)([2-9].{6})$/ - field :area_name, "Oregon" - field :area_type, "state" - field :area_abbreviation, "OR" - builder() + + def regex, do: ~r/^(1)(458|503|541|971)([2-9].{6})$/ + def area_name, do: "Oregon" + def area_type, do: "state" + def area_abbreviation, do: "OR" + + matcher ["1458", "1503", "1541", "1971"] end diff --git a/lib/phone/nanp/us/pa.ex b/lib/phone/nanp/us/pa.ex index 79a4eed..13bdb3c 100644 --- a/lib/phone/nanp/us/pa.ex +++ b/lib/phone/nanp/us/pa.ex @@ -1,8 +1,11 @@ defmodule Phone.NANP.US.PA do use Helper.Area - field :regex, ~r/^(1)(215|267|272|412|484|570|610|717|724|814|878)([2-9].{6})$/ - field :area_name, "Pennsylvania" - field :area_type, "state" - field :area_abbreviation, "PA" - builder() + + def regex, do: ~r/^(1)(215|267|272|412|484|570|610|717|724|814|878)([2-9].{6})$/ + def area_name, do: "Pennsylvania" + def area_type, do: "state" + def area_abbreviation, do: "PA" + + matcher ["1215", "1267", "1272", "1412", "1484", "1570", "1610", "1717", "1724", + "1814", "1878"] end diff --git a/lib/phone/nanp/us/ri.ex b/lib/phone/nanp/us/ri.ex index b7ec0db..551db96 100644 --- a/lib/phone/nanp/us/ri.ex +++ b/lib/phone/nanp/us/ri.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.RI do use Helper.Area - field :regex, ~r/^(1)(401)([2-9].{6})$/ - field :area_name, "Rhode Island" - field :area_type, "state" - field :area_abbreviation, "RI" - builder() + + def regex, do: ~r/^(1)(401)([2-9].{6})$/ + def area_name, do: "Rhode Island" + def area_type, do: "state" + def area_abbreviation, do: "RI" + + matcher ["1401"] end diff --git a/lib/phone/nanp/us/sc.ex b/lib/phone/nanp/us/sc.ex index c4ff68d..9b8e74f 100644 --- a/lib/phone/nanp/us/sc.ex +++ b/lib/phone/nanp/us/sc.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.SC do use Helper.Area - field :regex, ~r/^(1)(803|843|854|864)([2-9].{6})$/ - field :area_name, "South Carolina" - field :area_type, "state" - field :area_abbreviation, "SC" - builder() + + def regex, do: ~r/^(1)(803|843|854|864)([2-9].{6})$/ + def area_name, do: "South Carolina" + def area_type, do: "state" + def area_abbreviation, do: "SC" + + matcher ["1803", "1843", "1854", "1864"] end diff --git a/lib/phone/nanp/us/sd.ex b/lib/phone/nanp/us/sd.ex index 044db01..9711dcc 100644 --- a/lib/phone/nanp/us/sd.ex +++ b/lib/phone/nanp/us/sd.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.SD do use Helper.Area - field :regex, ~r/^(1)(605)([2-9].{6})$/ - field :area_name, "South Dakota" - field :area_type, "state" - field :area_abbreviation, "SD" - builder() + + def regex, do: ~r/^(1)(605)([2-9].{6})$/ + def area_name, do: "South Dakota" + def area_type, do: "state" + def area_abbreviation, do: "SD" + + matcher ["1605"] end diff --git a/lib/phone/nanp/us/tn.ex b/lib/phone/nanp/us/tn.ex index 85f1ae7..7e5d0e1 100644 --- a/lib/phone/nanp/us/tn.ex +++ b/lib/phone/nanp/us/tn.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.TN do use Helper.Area - field :regex, ~r/^(1)(423|615|629|731|865|901|931)([2-9].{6})$/ - field :area_name, "Tennessee" - field :area_type, "state" - field :area_abbreviation, "TN" - builder() + + def regex, do: ~r/^(1)(423|615|629|731|865|901|931)([2-9].{6})$/ + def area_name, do: "Tennessee" + def area_type, do: "state" + def area_abbreviation, do: "TN" + + matcher ["1423", "1615", "1629", "1731", "1865", "1901", "1931"] end diff --git a/lib/phone/nanp/us/tx.ex b/lib/phone/nanp/us/tx.ex index 23b2a98..26e1895 100644 --- a/lib/phone/nanp/us/tx.ex +++ b/lib/phone/nanp/us/tx.ex @@ -1,8 +1,12 @@ defmodule Phone.NANP.US.TX do use Helper.Area - field :regex, ~r/^(1)(210|214|254|281|325|346|361|409|430|432|469|512|682|713|737|806|817|830|832|903|915|936|940|956|972|979)([2-9].{6})$/ - field :area_name, "Texas" - field :area_type, "state" - field :area_abbreviation, "TX" - builder() + + def regex, do: ~r/^(1)(210|214|254|281|325|346|361|409|430|432|469|512|682|713|737|806|817|830|832|903|915|936|940|956|972|979)([2-9].{6})$/ + def area_name, do: "Texas" + def area_type, do: "state" + def area_abbreviation, do: "TX" + + matcher ["1210", "1214", "1254", "1281", "1325", "1346", "1361", "1409", "1430", + "1432", "1469", "1512", "1682", "1713", "1737", "1806", "1817", "1830", + "1832", "1903", "1915", "1936", "1940", "1956", "1972", "1979"] end diff --git a/lib/phone/nanp/us/ut.ex b/lib/phone/nanp/us/ut.ex index d7e0879..e15eafa 100644 --- a/lib/phone/nanp/us/ut.ex +++ b/lib/phone/nanp/us/ut.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.UT do use Helper.Area - field :regex, ~r/^(1)(385|435|801)([2-9].{6})$/ - field :area_name, "Utah" - field :area_type, "state" - field :area_abbreviation, "UT" - builder() + + def regex, do: ~r/^(1)(385|435|801)([2-9].{6})$/ + def area_name, do: "Utah" + def area_type, do: "state" + def area_abbreviation, do: "UT" + + matcher ["1385", "1435", "1801"] end diff --git a/lib/phone/nanp/us/va.ex b/lib/phone/nanp/us/va.ex index 9b8bcb6..fd8f32f 100644 --- a/lib/phone/nanp/us/va.ex +++ b/lib/phone/nanp/us/va.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.VA do use Helper.Area - field :regex, ~r/^(1)(276|434|540|571|703|757|804)([2-9].{6})$/ - field :area_name, "Virginia" - field :area_type, "state" - field :area_abbreviation, "VA" - builder() + + def regex, do: ~r/^(1)(276|434|540|571|703|757|804)([2-9].{6})$/ + def area_name, do: "Virginia" + def area_type, do: "state" + def area_abbreviation, do: "VA" + + matcher ["1276", "1434", "1540", "1571", "1703", "1757", "1804"] end diff --git a/lib/phone/nanp/us/vt.ex b/lib/phone/nanp/us/vt.ex index c95abc4..4ca7114 100644 --- a/lib/phone/nanp/us/vt.ex +++ b/lib/phone/nanp/us/vt.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.VT do use Helper.Area - field :regex, ~r/^(1)(802)([2-9].{6})$/ - field :area_name, "Vermont" - field :area_type, "state" - field :area_abbreviation, "VT" - builder() + + def regex, do: ~r/^(1)(802)([2-9].{6})$/ + def area_name, do: "Vermont" + def area_type, do: "state" + def area_abbreviation, do: "VT" + + matcher ["1802"] end diff --git a/lib/phone/nanp/us/wa.ex b/lib/phone/nanp/us/wa.ex index 2b29cd6..7fc5a02 100644 --- a/lib/phone/nanp/us/wa.ex +++ b/lib/phone/nanp/us/wa.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.WA do use Helper.Area - field :regex, ~r/^(1)(206|253|360|425|509)([2-9].{6})$/ - field :area_name, "Washington" - field :area_type, "state" - field :area_abbreviation, "WA" - builder() + + def regex, do: ~r/^(1)(206|253|360|425|509)([2-9].{6})$/ + def area_name, do: "Washington" + def area_type, do: "state" + def area_abbreviation, do: "WA" + + matcher ["1206", "1253", "1360", "1425", "1509"] end diff --git a/lib/phone/nanp/us/wi.ex b/lib/phone/nanp/us/wi.ex index 3cee255..d47b7f9 100644 --- a/lib/phone/nanp/us/wi.ex +++ b/lib/phone/nanp/us/wi.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.WI do use Helper.Area - field :regex, ~r/^(1)(262|414|534|608|715|920)([2-9].{6})$/ - field :area_name, "Wisconsin" - field :area_type, "state" - field :area_abbreviation, "WI" - builder() + + def regex, do: ~r/^(1)(262|414|534|608|715|920)([2-9].{6})$/ + def area_name, do: "Wisconsin" + def area_type, do: "state" + def area_abbreviation, do: "WI" + + matcher ["1262", "1414", "1534", "1608", "1715", "1920"] end diff --git a/lib/phone/nanp/us/wv.ex b/lib/phone/nanp/us/wv.ex index 977b027..df8ed25 100644 --- a/lib/phone/nanp/us/wv.ex +++ b/lib/phone/nanp/us/wv.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.WV do use Helper.Area - field :regex, ~r/^(1)(304|681)([2-9].{6})$/ - field :area_name, "West Virginia" - field :area_type, "state" - field :area_abbreviation, "WV" - builder() + + def regex, do: ~r/^(1)(304|681)([2-9].{6})$/ + def area_name, do: "West Virginia" + def area_type, do: "state" + def area_abbreviation, do: "WV" + + matcher ["1304", "1681"] end diff --git a/lib/phone/nanp/us/wy.ex b/lib/phone/nanp/us/wy.ex index 6ed1c9a..be900ee 100644 --- a/lib/phone/nanp/us/wy.ex +++ b/lib/phone/nanp/us/wy.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.US.WY do use Helper.Area - field :regex, ~r/^(1)(307)([2-9].{6})$/ - field :area_name, "Wyoming" - field :area_type, "state" - field :area_abbreviation, "WY" - builder() + + def regex, do: ~r/^(1)(307)([2-9].{6})$/ + def area_name, do: "Wyoming" + def area_type, do: "state" + def area_abbreviation, do: "WY" + + matcher ["1307"] end diff --git a/lib/phone/nanp/vc.ex b/lib/phone/nanp/vc.ex index 135f27f..1cfd052 100644 --- a/lib/phone/nanp/vc.ex +++ b/lib/phone/nanp/vc.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.VC do use Helper.Country - field :regex, ~r/^(1)(784)([2-9].{6})$/ - field :country, "Saint Vicent and the Grenadines" - field :a2, "VC" - field :a3, "VCT" - match :regex + + def regex, do: ~r/^(1)(784)([2-9].{6})$/ + def country, do: "Saint Vicent and the Grenadines" + def a2, do: "VC" + def a3, do: "VCT" + + matcher :regex, ["1784"] end diff --git a/lib/phone/nanp/vg.ex b/lib/phone/nanp/vg.ex index 4c59cd6..3b2a745 100644 --- a/lib/phone/nanp/vg.ex +++ b/lib/phone/nanp/vg.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.VG do use Helper.Country - field :regex, ~r/^(1)(284)([2-9].{6})$/ - field :country, "British Virgin Islands" - field :a2, "VG" - field :a3, "VGB" - match :regex + + def regex, do: ~r/^(1)(284)([2-9].{6})$/ + def country, do: "British Virgin Islands" + def a2, do: "VG" + def a3, do: "VGB" + + matcher :regex, ["1284"] end diff --git a/lib/phone/nanp/vi.ex b/lib/phone/nanp/vi.ex index 827a715..0c12e03 100644 --- a/lib/phone/nanp/vi.ex +++ b/lib/phone/nanp/vi.ex @@ -1,8 +1,10 @@ defmodule Phone.NANP.VI do use Helper.Country - field :regex, ~r/^(1)(340)([2-9].{6})$/ - field :country, "US Virgin Islands" - field :a2, "VI" - field :a3, "VIR" - match :regex + + def regex, do: ~r/^(1)(340)([2-9].{6})$/ + def country, do: "US Virgin Islands" + def a2, do: "VI" + def a3, do: "VIR" + + matcher :regex, ["1340"] end diff --git a/lib/phone/nc.ex b/lib/phone/nc.ex index 22b1dff..b9d83a5 100644 --- a/lib/phone/nc.ex +++ b/lib/phone/nc.ex @@ -1,8 +1,10 @@ defmodule Phone.NC do use Helper.Country - field :regex, ~r/^(687)()(.{6})/ - field :country, "New Caledonia" - field :a2, "NC" - field :a3, "NCL" - match :regex + + def regex, do: ~r/^(687)()(.{6})/ + def country, do: "New Caledonia" + def a2, do: "NC" + def a3, do: "NCL" + + matcher :regex, ["687"] end diff --git a/lib/phone/ne.ex b/lib/phone/ne.ex index 8a92d19..d712627 100644 --- a/lib/phone/ne.ex +++ b/lib/phone/ne.ex @@ -1,8 +1,10 @@ defmodule Phone.NE do use Helper.Country - field :regex, ~r/^(227)()(.{8})/ - field :country, "Niger" - field :a2, "NE" - field :a3, "NER" - match :regex + + def regex, do: ~r/^(227)()(.{8})/ + def country, do: "Niger" + def a2, do: "NE" + def a3, do: "NER" + + matcher :regex, ["227"] end diff --git a/lib/phone/ng.ex b/lib/phone/ng.ex index 8601d9a..29fb2ca 100644 --- a/lib/phone/ng.ex +++ b/lib/phone/ng.ex @@ -1,8 +1,10 @@ defmodule Phone.NG do use Helper.Country - field :regex, ~r/^(234)()(.+)/ - field :country, "Nigeria" - field :a2, "NG" - field :a3, "NGA" - match :regex + + def regex, do: ~r/^(234)()(.+)/ + def country, do: "Nigeria" + def a2, do: "NG" + def a3, do: "NGA" + + matcher :regex, ["234"] end diff --git a/lib/phone/ni.ex b/lib/phone/ni.ex index 40e30ba..b9116aa 100644 --- a/lib/phone/ni.ex +++ b/lib/phone/ni.ex @@ -1,8 +1,10 @@ defmodule Phone.NI do use Helper.Country - field :regex, ~r/^(505)()(.{8})/ - field :country, "Nicaragua" - field :a2, "NI" - field :a3, "NIC" - match :regex + + def regex, do: ~r/^(505)()(.{8})/ + def country, do: "Nicaragua" + def a2, do: "NI" + def a3, do: "NIC" + + matcher :regex, ["505"] end diff --git a/lib/phone/nl.ex b/lib/phone/nl.ex index ffd0f23..d2758fc 100644 --- a/lib/phone/nl.ex +++ b/lib/phone/nl.ex @@ -1,8 +1,10 @@ defmodule Phone.NL do use Helper.Country - field :regex, ~r/^(31)()(.{9})/ - field :country, "Netherlands" - field :a2, "NL" - field :a3, "NLD" - match :regex + + def regex, do: ~r/^(31)()(.{9})/ + def country, do: "Netherlands" + def a2, do: "NL" + def a3, do: "NLD" + + matcher :regex, ["31"] end diff --git a/lib/phone/no.ex b/lib/phone/no.ex index 428cb94..e64c9ca 100644 --- a/lib/phone/no.ex +++ b/lib/phone/no.ex @@ -1,8 +1,10 @@ defmodule Phone.NO do use Helper.Country - field :regex, ~r/^(47)()([2-9].{7}|0.{3})/ - field :country, "Norway" - field :a2, "NO" - field :a3, "NOR" - match :regex + + def regex, do: ~r/^(47)()([2-9].{7}|0.{3})/ + def country, do: "Norway" + def a2, do: "NO" + def a3, do: "NOR" + + matcher :regex, ["47"] end diff --git a/lib/phone/np.ex b/lib/phone/np.ex index 7e7a85e..d54f84d 100644 --- a/lib/phone/np.ex +++ b/lib/phone/np.ex @@ -1,8 +1,10 @@ defmodule Phone.NP do use Helper.Country - field :regex, ~r/^(977)()(.{8})/ - field :country, "Nepal" - field :a2, "NP" - field :a3, "NPL" - match :regex + + def regex, do: ~r/^(977)()(.{8})/ + def country, do: "Nepal" + def a2, do: "NP" + def a3, do: "NPL" + + matcher :regex, ["977"] end diff --git a/lib/phone/nr.ex b/lib/phone/nr.ex index 83871ba..1c0729c 100644 --- a/lib/phone/nr.ex +++ b/lib/phone/nr.ex @@ -1,8 +1,10 @@ defmodule Phone.NR do use Helper.Country - field :regex, ~r/^(674)()(.{7})/ - field :country, "Nauru" - field :a2, "NR" - field :a3, "NRU" - match :regex + + def regex, do: ~r/^(674)()(.{7})/ + def country, do: "Nauru" + def a2, do: "NR" + def a3, do: "NRU" + + matcher :regex, ["674"] end diff --git a/lib/phone/nu.ex b/lib/phone/nu.ex index 36232cd..339543a 100644 --- a/lib/phone/nu.ex +++ b/lib/phone/nu.ex @@ -1,8 +1,10 @@ defmodule Phone.NU do use Helper.Country - field :regex, ~r/^(683)()(.{4})/ - field :country, "Niue" - field :a2, "NU" - field :a3, "NIU" - match :regex + + def regex, do: ~r/^(683)()(.{4})/ + def country, do: "Niue" + def a2, do: "NU" + def a3, do: "NIU" + + matcher :regex, ["683"] end diff --git a/lib/phone/nz.ex b/lib/phone/nz.ex index 83d28ba..698cc8f 100644 --- a/lib/phone/nz.ex +++ b/lib/phone/nz.ex @@ -1,8 +1,10 @@ defmodule Phone.NZ do use Helper.Country - field :regex, ~r/^(64)()(.+)/ - field :country, "New Zealand" - field :a2, "NZ" - field :a3, "NZL" - match :regex + + def regex, do: ~r/^(64)()(.+)/ + def country, do: "New Zealand" + def a2, do: "NZ" + def a3, do: "NZL" + + matcher :regex, ["64"] end diff --git a/lib/phone/om.ex b/lib/phone/om.ex index 3e3fa4a..4e9e6c3 100644 --- a/lib/phone/om.ex +++ b/lib/phone/om.ex @@ -1,8 +1,10 @@ defmodule Phone.OM do use Helper.Country - field :regex, ~r/^(968)()(.{8})/ - field :country, "Oman" - field :a2, "OM" - field :a3, "OMN" - match :regex + + def regex, do: ~r/^(968)()(.{8})/ + def country, do: "Oman" + def a2, do: "OM" + def a3, do: "OMN" + + matcher :regex, ["968"] end diff --git a/lib/phone/pa.ex b/lib/phone/pa.ex index 043ad1a..ebacb8b 100644 --- a/lib/phone/pa.ex +++ b/lib/phone/pa.ex @@ -1,8 +1,10 @@ defmodule Phone.PA do use Helper.Country - field :regex, ~r/^(507)()(.{7})/ - field :country, "Panama" - field :a2, "PA" - field :a3, "PAN" - match :regex + + def regex, do: ~r/^(507)()(.{7})/ + def country, do: "Panama" + def a2, do: "PA" + def a3, do: "PAN" + + matcher :regex, ["507"] end diff --git a/lib/phone/pe.ex b/lib/phone/pe.ex index 313a01c..df106ae 100644 --- a/lib/phone/pe.ex +++ b/lib/phone/pe.ex @@ -1,8 +1,10 @@ defmodule Phone.PE do use Helper.Country - field :regex, ~r/^(51)()(.{8,9})/ - field :country, "Peru" - field :a2, "PE" - field :a3, "PER" - match :regex + + def regex, do: ~r/^(51)()(.{8,9})/ + def country, do: "Peru" + def a2, do: "PE" + def a3, do: "PER" + + matcher :regex, ["51"] end diff --git a/lib/phone/pf.ex b/lib/phone/pf.ex index 1a72f41..e4b2ed4 100644 --- a/lib/phone/pf.ex +++ b/lib/phone/pf.ex @@ -1,8 +1,10 @@ defmodule Phone.PF do use Helper.Country - field :regex, ~r/^(689)()(.{8})/ - field :country, "French Polynesia" - field :a2, "PF" - field :a3, "PYF" - match :regex + + def regex, do: ~r/^(689)()(.{8})/ + def country, do: "French Polynesia" + def a2, do: "PF" + def a3, do: "PYF" + + matcher :regex, ["689"] end diff --git a/lib/phone/pg.ex b/lib/phone/pg.ex index 04d123e..669db89 100644 --- a/lib/phone/pg.ex +++ b/lib/phone/pg.ex @@ -1,8 +1,10 @@ defmodule Phone.PG do use Helper.Country - field :regex, ~r/^(675)()(.+)/ - field :country, "Papua New Guinea" - field :a2, "PG" - field :a3, "PNG" - match :regex + + def regex, do: ~r/^(675)()(.+)/ + def country, do: "Papua New Guinea" + def a2, do: "PG" + def a3, do: "PNG" + + matcher :regex, ["675"] end diff --git a/lib/phone/ph.ex b/lib/phone/ph.ex index 7305b71..1a954d4 100644 --- a/lib/phone/ph.ex +++ b/lib/phone/ph.ex @@ -1,8 +1,10 @@ defmodule Phone.PH do use Helper.Country - field :regex, ~r/^(63)()(.+)/ - field :country, "Philippines" - field :a2, "PH" - field :a3, "PHL" - match :regex + + def regex, do: ~r/^(63)()(.+)/ + def country, do: "Philippines" + def a2, do: "PH" + def a3, do: "PHL" + + matcher :regex, ["63"] end diff --git a/lib/phone/pk.ex b/lib/phone/pk.ex index 666f9f3..1fbaae9 100644 --- a/lib/phone/pk.ex +++ b/lib/phone/pk.ex @@ -1,8 +1,10 @@ defmodule Phone.PK do use Helper.Country - field :regex, ~r/^(92)()(.+'')/ - field :country, "Pakistan" - field :a2, "PK" - field :a3, "PAK" - match :regex + + def regex, do: ~r/^(92)()(.+'')/ + def country, do: "Pakistan" + def a2, do: "PK" + def a3, do: "PAK" + + matcher :regex, ["92"] end diff --git a/lib/phone/pl.ex b/lib/phone/pl.ex index 104590a..f4612b6 100644 --- a/lib/phone/pl.ex +++ b/lib/phone/pl.ex @@ -1,8 +1,10 @@ defmodule Phone.PL do use Helper.Country - field :regex, ~r/^(48)()(.+)/ - field :country, "Poland" - field :a2, "PL" - field :a3, "POL" - match :regex + + def regex, do: ~r/^(48)()(.+)/ + def country, do: "Poland" + def a2, do: "PL" + def a3, do: "POL" + + matcher :regex, ["48"] end diff --git a/lib/phone/pm.ex b/lib/phone/pm.ex index 7b9edbf..d820e72 100644 --- a/lib/phone/pm.ex +++ b/lib/phone/pm.ex @@ -1,8 +1,10 @@ defmodule Phone.PM do use Helper.Country - field :regex, ~r/^(508)()(.{6})/ - field :country, "Saint Pierre and Miquelon" - field :a2, "PM" - field :a3, "SPM" - match :regex + + def regex, do: ~r/^(508)()(.{6})/ + def country, do: "Saint Pierre and Miquelon" + def a2, do: "PM" + def a3, do: "SPM" + + matcher :regex, ["508"] end diff --git a/lib/phone/ps.ex b/lib/phone/ps.ex index 3cda12c..e04b54a 100644 --- a/lib/phone/ps.ex +++ b/lib/phone/ps.ex @@ -1,8 +1,10 @@ defmodule Phone.PS do use Helper.Country - field :regex, ~r/^(970)()(.{8,9})/ - field :country, "Palestine" - field :a2, "DJ" - field :a3, "DJI" - match :regex + + def regex, do: ~r/^(970)()(.{8,9})/ + def country, do: "Palestine" + def a2, do: "DJ" + def a3, do: "DJI" + + matcher :regex, ["970"] end diff --git a/lib/phone/pt.ex b/lib/phone/pt.ex index 7b6ffa5..64885b3 100644 --- a/lib/phone/pt.ex +++ b/lib/phone/pt.ex @@ -1,8 +1,10 @@ defmodule Phone.PT do use Helper.Country - field :regex, ~r/^(351)()(.{9})/ - field :country, "Portugal" - field :a2, "PT" - field :a3, "PRT" - match :regex + + def regex, do: ~r/^(351)()(.{9})/ + def country, do: "Portugal" + def a2, do: "PT" + def a3, do: "PRT" + + matcher :regex, ["351"] end diff --git a/lib/phone/pw.ex b/lib/phone/pw.ex index 634a5b9..74ab8a2 100644 --- a/lib/phone/pw.ex +++ b/lib/phone/pw.ex @@ -1,8 +1,10 @@ defmodule Phone.PW do use Helper.Country - field :regex, ~r/^(680)()(.{7})/ - field :country, "Palau" - field :a2, "PW" - field :a3, "PLW" - match :regex + + def regex, do: ~r/^(680)()(.{7})/ + def country, do: "Palau" + def a2, do: "PW" + def a3, do: "PLW" + + matcher :regex, ["680"] end diff --git a/lib/phone/py.ex b/lib/phone/py.ex index 9148eeb..24e61ff 100644 --- a/lib/phone/py.ex +++ b/lib/phone/py.ex @@ -1,8 +1,10 @@ defmodule Phone.PY do use Helper.Country - field :regex, ~r/^(595)()(.+)/ - field :country, "Paraguay" - field :a2, "PY" - field :a3, "PRY" - match :regex + + def regex, do: ~r/^(595)()(.+)/ + def country, do: "Paraguay" + def a2, do: "PY" + def a3, do: "PRY" + + matcher :regex, ["595"] end diff --git a/lib/phone/qa.ex b/lib/phone/qa.ex index 9597a8b..2865efb 100644 --- a/lib/phone/qa.ex +++ b/lib/phone/qa.ex @@ -1,8 +1,10 @@ defmodule Phone.QA do use Helper.Country - field :regex, ~r/^(974)()(.{8})/ - field :country, "Qatar" - field :a2, "QA" - field :a3, "QAT" - match :regex + + def regex, do: ~r/^(974)()(.{8})/ + def country, do: "Qatar" + def a2, do: "QA" + def a3, do: "QAT" + + matcher :regex, ["974"] end diff --git a/lib/phone/ro.ex b/lib/phone/ro.ex index 9126466..ed6c5c2 100644 --- a/lib/phone/ro.ex +++ b/lib/phone/ro.ex @@ -1,8 +1,10 @@ defmodule Phone.RO do use Helper.Country - field :regex, ~r/^(40)()(.{9})/ - field :country, "Romania" - field :a2, "RO" - field :a3, "ROU" - match :regex + + def regex, do: ~r/^(40)()(.{9})/ + def country, do: "Romania" + def a2, do: "RO" + def a3, do: "ROU" + + matcher :regex, ["40"] end diff --git a/lib/phone/rs.ex b/lib/phone/rs.ex index 4d3545f..d29629f 100644 --- a/lib/phone/rs.ex +++ b/lib/phone/rs.ex @@ -1,8 +1,10 @@ defmodule Phone.RS do use Helper.Country - field :regex, ~r/^(381)()(.+)/ - field :country, "Serbia" - field :a2, "RS" - field :a3, "SRB" - match :regex + + def regex, do: ~r/^(381)()(.+)/ + def country, do: "Serbia" + def a2, do: "RS" + def a3, do: "SRB" + + matcher :regex, ["381"] end diff --git a/lib/phone/ru.ex b/lib/phone/ru.ex index abb6e1b..a3d3b9f 100644 --- a/lib/phone/ru.ex +++ b/lib/phone/ru.ex @@ -1,8 +1,10 @@ defmodule Phone.RU do use Helper.Country - field :regex, ~r/^(7)([3-589]..)(.{7})/ - field :country, "Russia" - field :a2, "RU" - field :a3, "RUS" - match :regex + + def regex, do: ~r/^(7)([3-589]..)(.{7})/ + def country, do: "Russia" + def a2, do: "RU" + def a3, do: "RUS" + + matcher :regex, ["73", "75", "78", "79"] end diff --git a/lib/phone/rw.ex b/lib/phone/rw.ex index 87cae10..e1264ab 100644 --- a/lib/phone/rw.ex +++ b/lib/phone/rw.ex @@ -1,8 +1,10 @@ defmodule Phone.RW do use Helper.Country - field :regex, ~r/^(250)()(.{9})/ - field :country, "Rwanda" - field :a2, "RW" - field :a3, "RWA" - match :regex + + def regex, do: ~r/^(250)()(.{9})/ + def country, do: "Rwanda" + def a2, do: "RW" + def a3, do: "RWA" + + matcher :regex, ["250"] end diff --git a/lib/phone/sa.ex b/lib/phone/sa.ex index c093bb5..72cfb8d 100644 --- a/lib/phone/sa.ex +++ b/lib/phone/sa.ex @@ -1,8 +1,10 @@ defmodule Phone.SA do use Helper.Country - field :regex, ~r/^(966)()(.+)/ - field :country, "Saudi Arabia" - field :a2, "SA" - field :a3, "SAU" - match :regex + + def regex, do: ~r/^(966)()(.+)/ + def country, do: "Saudi Arabia" + def a2, do: "SA" + def a3, do: "SAU" + + matcher :regex, ["966"] end diff --git a/lib/phone/sb.ex b/lib/phone/sb.ex index 743ccc2..5a3d236 100644 --- a/lib/phone/sb.ex +++ b/lib/phone/sb.ex @@ -1,8 +1,10 @@ defmodule Phone.SB do use Helper.Country - field :regex, ~r/^(677)()(.+)/ - field :country, "Solomon Islands" - field :a2, "SB" - field :a3, "SLB" - match :regex + + def regex, do: ~r/^(677)()(.+)/ + def country, do: "Solomon Islands" + def a2, do: "SB" + def a3, do: "SLB" + + matcher :regex, ["677"] end diff --git a/lib/phone/sc.ex b/lib/phone/sc.ex index cbb64d4..ccc8c08 100644 --- a/lib/phone/sc.ex +++ b/lib/phone/sc.ex @@ -1,8 +1,10 @@ defmodule Phone.SC do use Helper.Country - field :regex, ~r/^(248)()(.{7})/ - field :country, "Seychelles" - field :a2, "SC" - field :a3, "SYC" - match :regex + + def regex, do: ~r/^(248)()(.{7})/ + def country, do: "Seychelles" + def a2, do: "SC" + def a3, do: "SYC" + + matcher :regex, ["248:"] end diff --git a/lib/phone/sd.ex b/lib/phone/sd.ex index a9cdb10..5205bee 100644 --- a/lib/phone/sd.ex +++ b/lib/phone/sd.ex @@ -1,8 +1,10 @@ defmodule Phone.SD do use Helper.Country - field :regex, ~r/^(249)()(.+)/ - field :country, "Sudan" - field :a2, "SD" - field :a3, "SDN" - match :regex + + def regex, do: ~r/^(249)()(.+)/ + def country, do: "Sudan" + def a2, do: "SD" + def a3, do: "SDN" + + matcher :regex, ["249"] end diff --git a/lib/phone/se.ex b/lib/phone/se.ex index 899114e..0560511 100644 --- a/lib/phone/se.ex +++ b/lib/phone/se.ex @@ -1,8 +1,10 @@ defmodule Phone.SE do use Helper.Country - field :regex, ~r/^(46)()(.+)/ - field :country, "Sweden" - field :a2, "SE" - field :a3, "SWE" - match :regex + + def regex, do: ~r/^(46)()(.+)/ + def country, do: "Sweden" + def a2, do: "SE" + def a3, do: "SWE" + + matcher :regex, ["46"] end diff --git a/lib/phone/sg.ex b/lib/phone/sg.ex index 6f3139c..6b6f150 100644 --- a/lib/phone/sg.ex +++ b/lib/phone/sg.ex @@ -1,8 +1,10 @@ defmodule Phone.SG do use Helper.Country - field :regex, ~r/^(65)()(.{8})/ - field :country, "Singapore" - field :a2, "SG" - field :a3, "SGP" - match :regex + + def regex, do: ~r/^(65)()(.{8})/ + def country, do: "Singapore" + def a2, do: "SG" + def a3, do: "SGP" + + matcher :regex, ["65"] end diff --git a/lib/phone/sh.ex b/lib/phone/sh.ex index 6ffa205..b57027d 100644 --- a/lib/phone/sh.ex +++ b/lib/phone/sh.ex @@ -1,8 +1,10 @@ defmodule Phone.SH do use Helper.Country - field :regex, ~r/^(290)()(.{5})/ - field :country, "Saint Helena and Tristan da Cunha" - field :a2, "SH" - field :a3, "SHN" - match :regex + + def regex, do: ~r/^(290)()(.{5})/ + def country, do: "Saint Helena and Tristan da Cunha" + def a2, do: "SH" + def a3, do: "SHN" + + matcher :regex, ["290"] end diff --git a/lib/phone/si.ex b/lib/phone/si.ex index 8bfce85..f09d9cb 100644 --- a/lib/phone/si.ex +++ b/lib/phone/si.ex @@ -1,8 +1,10 @@ defmodule Phone.SI do use Helper.Country - field :regex, ~r/^(386)()(.+)/ - field :country, "Slovenia" - field :a2, "SI" - field :a3, "SVN" - match :regex + + def regex, do: ~r/^(386)()(.+)/ + def country, do: "Slovenia" + def a2, do: "SI" + def a3, do: "SVN" + + matcher :regex, ["386"] end diff --git a/lib/phone/sk.ex b/lib/phone/sk.ex index 5a2ddef..8cd03dc 100644 --- a/lib/phone/sk.ex +++ b/lib/phone/sk.ex @@ -1,8 +1,10 @@ defmodule Phone.SK do use Helper.Country - field :regex, ~r/^(421)()(.+)/ - field :country, "Slovakia" - field :a2, "SK" - field :a3, "SVK" - match :regex + + def regex, do: ~r/^(421)()(.+)/ + def country, do: "Slovakia" + def a2, do: "SK" + def a3, do: "SVK" + + matcher :regex, ["421"] end diff --git a/lib/phone/sl.ex b/lib/phone/sl.ex index a02c123..febd9b1 100644 --- a/lib/phone/sl.ex +++ b/lib/phone/sl.ex @@ -1,8 +1,10 @@ defmodule Phone.SL do use Helper.Country - field :regex, ~r/^(232)(..)(.{6})/ - field :country, "Sierra Leone" - field :a2, "SL" - field :a3, "SLE" - match :regex + + def regex, do: ~r/^(232)(..)(.{6})/ + def country, do: "Sierra Leone" + def a2, do: "SL" + def a3, do: "SLE" + + matcher :regex, ["232"] end diff --git a/lib/phone/sm.ex b/lib/phone/sm.ex index 12c37f7..a9645b6 100644 --- a/lib/phone/sm.ex +++ b/lib/phone/sm.ex @@ -1,8 +1,10 @@ defmodule Phone.SM do use Helper.Country - field :regex, ~r/^(378)(0549)(.{6})/ - field :country, "San Marino" - field :a2, "SM" - field :a3, "SMR" - match :regex + + def regex, do: ~r/^(378)(0549)(.{6})/ + def country, do: "San Marino" + def a2, do: "SM" + def a3, do: "SMR" + + matcher :regex, ["3780549"] end diff --git a/lib/phone/sn.ex b/lib/phone/sn.ex index 7a7e6e0..bfaefe8 100644 --- a/lib/phone/sn.ex +++ b/lib/phone/sn.ex @@ -1,8 +1,10 @@ defmodule Phone.SN do use Helper.Country - field :regex, ~r/^(221)()(.{7})/ - field :country, "Senegal" - field :a2, "SN" - field :a3, "SEN" - match :regex + + def regex, do: ~r/^(221)()(.{7})/ + def country, do: "Senegal" + def a2, do: "SN" + def a3, do: "SEN" + + matcher :regex, ["221"] end diff --git a/lib/phone/so.ex b/lib/phone/so.ex index d72b38c..a572301 100644 --- a/lib/phone/so.ex +++ b/lib/phone/so.ex @@ -1,8 +1,10 @@ defmodule Phone.SO do use Helper.Country - field :regex, ~r/^(252)()(.+)/ - field :country, "Somalia" - field :a2, "SO" - field :a3, "SOM" - match :regex + + def regex, do: ~r/^(252)()(.+)/ + def country, do: "Somalia" + def a2, do: "SO" + def a3, do: "SOM" + + matcher :regex, ["252"] end diff --git a/lib/phone/sr.ex b/lib/phone/sr.ex index d283cb8..aaf5879 100644 --- a/lib/phone/sr.ex +++ b/lib/phone/sr.ex @@ -1,8 +1,10 @@ defmodule Phone.SR do use Helper.Country - field :regex, ~r/^(597)()(.{6,7})/ - field :country, "Suriname" - field :a2, "SR" - field :a3, "SUR" - match :regex + + def regex, do: ~r/^(597)()(.{6,7})/ + def country, do: "Suriname" + def a2, do: "SR" + def a3, do: "SUR" + + matcher :regex, ["597"] end diff --git a/lib/phone/ss.ex b/lib/phone/ss.ex index 26a5b44..a28437a 100644 --- a/lib/phone/ss.ex +++ b/lib/phone/ss.ex @@ -1,8 +1,10 @@ defmodule Phone.SS do use Helper.Country - field :regex, ~r/^(211)()(.+)/ - field :country, "South Sudan" - field :a2, "SS" - field :a3, "SSD" - match :regex + + def regex, do: ~r/^(211)()(.+)/ + def country, do: "South Sudan" + def a2, do: "SS" + def a3, do: "SSD" + + matcher :regex, ["211"] end diff --git a/lib/phone/st.ex b/lib/phone/st.ex index f96be51..9175948 100644 --- a/lib/phone/st.ex +++ b/lib/phone/st.ex @@ -1,8 +1,10 @@ defmodule Phone.ST do use Helper.Country - field :regex, ~r/^(239)()(.{7})/ - field :country, "Sao Tome and Principe" - field :a2, "ST" - field :a3, "STP" - match :regex + + def regex, do: ~r/^(239)()(.{7})/ + def country, do: "Sao Tome and Principe" + def a2, do: "ST" + def a3, do: "STP" + + matcher :regex, ["239"] end diff --git a/lib/phone/sv.ex b/lib/phone/sv.ex index 2149e1c..5a2d405 100644 --- a/lib/phone/sv.ex +++ b/lib/phone/sv.ex @@ -1,8 +1,10 @@ defmodule Phone.SV do use Helper.Country - field :regex, ~r/^(503)()(.{7,8})/ - field :country, "El Salvador" - field :a2, "SV" - field :a3, "SLV" - match :regex + + def regex, do: ~r/^(503)()(.{7,8})/ + def country, do: "El Salvador" + def a2, do: "SV" + def a3, do: "SLV" + + matcher :regex, ["503"] end diff --git a/lib/phone/sy.ex b/lib/phone/sy.ex index e86232d..ed8b5f3 100644 --- a/lib/phone/sy.ex +++ b/lib/phone/sy.ex @@ -1,8 +1,10 @@ defmodule Phone.SY do use Helper.Country - field :regex, ~r/^(963)()(.+)/ - field :country, "Syria" - field :a2, "SY" - field :a3, "SYR" - match :regex + + def regex, do: ~r/^(963)()(.+)/ + def country, do: "Syria" + def a2, do: "SY" + def a3, do: "SYR" + + matcher :regex, ["963"] end diff --git a/lib/phone/sz.ex b/lib/phone/sz.ex index 260b66a..9006fb4 100644 --- a/lib/phone/sz.ex +++ b/lib/phone/sz.ex @@ -1,8 +1,10 @@ defmodule Phone.SZ do use Helper.Country - field :regex, ~r/^(268)()(.{8})/ - field :country, "Swaziland" - field :a2, "SZ" - field :a3, "SWZ" - match :regex + + def regex, do: ~r/^(268)()(.{8})/ + def country, do: "Swaziland" + def a2, do: "SZ" + def a3, do: "SWZ" + + matcher :regex, ["268"] end diff --git a/lib/phone/td.ex b/lib/phone/td.ex index eeae04d..222a657 100644 --- a/lib/phone/td.ex +++ b/lib/phone/td.ex @@ -1,8 +1,10 @@ defmodule Phone.TD do use Helper.Country - field :regex, ~r/^(235)()(.{8})/ - field :country, "Chad" - field :a2, "TD" - field :a3, "TCD" - match :regex + + def regex, do: ~r/^(235)()(.{8})/ + def country, do: "Chad" + def a2, do: "TD" + def a3, do: "TCD" + + matcher :regex, ["235"] end diff --git a/lib/phone/tg.ex b/lib/phone/tg.ex index d6182bd..859f89e 100644 --- a/lib/phone/tg.ex +++ b/lib/phone/tg.ex @@ -1,8 +1,10 @@ defmodule Phone.TG do use Helper.Country - field :regex, ~r/^(228)()(.{8})/ - field :country, "Togo" - field :a2, "TG" - field :a3, "TGO" - match :regex + + def regex, do: ~r/^(228)()(.{8})/ + def country, do: "Togo" + def a2, do: "TG" + def a3, do: "TGO" + + matcher :regex, ["228"] end diff --git a/lib/phone/th.ex b/lib/phone/th.ex index 0e06131..a4d53f6 100644 --- a/lib/phone/th.ex +++ b/lib/phone/th.ex @@ -1,8 +1,10 @@ defmodule Phone.TH do use Helper.Country - field :regex, ~r/^(66)()(.+)/ - field :country, "Thailand" - field :a2, "TH" - field :a3, "THA" - match :regex + + def regex, do: ~r/^(66)()(.+)/ + def country, do: "Thailand" + def a2, do: "TH" + def a3, do: "THA" + + matcher :regex, ["66"] end diff --git a/lib/phone/tj.ex b/lib/phone/tj.ex index 00c7957..7e55b92 100644 --- a/lib/phone/tj.ex +++ b/lib/phone/tj.ex @@ -1,8 +1,10 @@ defmodule Phone.TJ do use Helper.Country - field :regex, ~r/^(992)()(.{9})/ - field :country, "Tajikistan" - field :a2, "TJ" - field :a3, "TJK" - match :regex + + def regex, do: ~r/^(992)()(.{9})/ + def country, do: "Tajikistan" + def a2, do: "TJ" + def a3, do: "TJK" + + matcher :regex, ["992"] end diff --git a/lib/phone/tk.ex b/lib/phone/tk.ex index bff06bd..df55321 100644 --- a/lib/phone/tk.ex +++ b/lib/phone/tk.ex @@ -1,8 +1,10 @@ defmodule Phone.TK do use Helper.Country - field :regex, ~r/^(690)([1-9])(.{3})/ - field :country, "Tokelau" - field :a2, "TK" - field :a3, "TKL" - match :regex + + def regex, do: ~r/^(690)([1-9])(.{3})/ + def country, do: "Tokelau" + def a2, do: "TK" + def a3, do: "TKL" + + matcher :regex, ["690"] end diff --git a/lib/phone/tl.ex b/lib/phone/tl.ex index 53599e1..31fdca7 100644 --- a/lib/phone/tl.ex +++ b/lib/phone/tl.ex @@ -1,8 +1,10 @@ defmodule Phone.TL do use Helper.Country - field :regex, ~r/^(670)()(.{8})/ - field :country, "East Timor" - field :a2, "TL" - field :a3, "TLS" - match :regex + + def regex, do: ~r/^(670)()(.{8})/ + def country, do: "East Timor" + def a2, do: "TL" + def a3, do: "TLS" + + matcher :regex, ["670"] end diff --git a/lib/phone/tm.ex b/lib/phone/tm.ex index 0a6adec..2016eff 100644 --- a/lib/phone/tm.ex +++ b/lib/phone/tm.ex @@ -1,8 +1,10 @@ defmodule Phone.TM do use Helper.Country - field :regex, ~r/^(993)()(.+)/ - field :country, "Turkmenistan" - field :a2, "TM" - field :a3, "TKM" - match :regex + + def regex, do: ~r/^(993)()(.+)/ + def country, do: "Turkmenistan" + def a2, do: "TM" + def a3, do: "TKM" + + matcher :regex, ["993"] end diff --git a/lib/phone/tn.ex b/lib/phone/tn.ex index 50fd18b..44d3a77 100644 --- a/lib/phone/tn.ex +++ b/lib/phone/tn.ex @@ -1,8 +1,10 @@ defmodule Phone.TN do use Helper.Country - field :regex, ~r/^(216)()(.{8})/ - field :country, "Tunisia" - field :a2, "TN" - field :a3, "TUN" - match :regex + + def regex, do: ~r/^(216)()(.{8})/ + def country, do: "Tunisia" + def a2, do: "TN" + def a3, do: "TUN" + + matcher :regex, ["216"] end diff --git a/lib/phone/to.ex b/lib/phone/to.ex index fbef1ec..d840621 100644 --- a/lib/phone/to.ex +++ b/lib/phone/to.ex @@ -1,8 +1,10 @@ defmodule Phone.TO do use Helper.Country - field :regex, ~r/^(676)()(.+)/ - field :country, "Tonga" - field :a2, "TO" - field :a3, "TON" - match :regex + + def regex, do: ~r/^(676)()(.+)/ + def country, do: "Tonga" + def a2, do: "TO" + def a3, do: "TON" + + matcher :regex, ["676"] end diff --git a/lib/phone/tr.ex b/lib/phone/tr.ex index d8ec3f4..270a9f1 100644 --- a/lib/phone/tr.ex +++ b/lib/phone/tr.ex @@ -1,8 +1,10 @@ defmodule Phone.TR do use Helper.Country - field :regex, ~r/^(90)(.{3})(.{7})/ - field :country, "Turkey" - field :a2, "TR" - field :a3, "TUR" - match :regex + + def regex, do: ~r/^(90)(.{3})(.{7})/ + def country, do: "Turkey" + def a2, do: "TR" + def a3, do: "TUR" + + matcher :regex, ["90"] end diff --git a/lib/phone/tv.ex b/lib/phone/tv.ex index 8d8477e..d4a11ac 100644 --- a/lib/phone/tv.ex +++ b/lib/phone/tv.ex @@ -1,8 +1,10 @@ defmodule Phone.TV do use Helper.Country - field :regex, ~r/^(688)()(.{5,6})/ - field :country, "Tuvalu" - field :a2, "TV" - field :a3, "TUV" - match :regex + + def regex, do: ~r/^(688)()(.{5,6})/ + def country, do: "Tuvalu" + def a2, do: "TV" + def a3, do: "TUV" + + matcher :regex, ["688"] end diff --git a/lib/phone/tw.ex b/lib/phone/tw.ex index 36bbe81..0b5735c 100644 --- a/lib/phone/tw.ex +++ b/lib/phone/tw.ex @@ -1,8 +1,10 @@ defmodule Phone.TW do use Helper.Country - field :regex, ~r/^(886)()(.+)/ - field :country, "Taiwan" - field :a2, "TW" - field :a3, "TWN" - match :regex + + def regex, do: ~r/^(886)()(.+)/ + def country, do: "Taiwan" + def a2, do: "TW" + def a3, do: "TWN" + + matcher :regex, ["886"] end diff --git a/lib/phone/tz.ex b/lib/phone/tz.ex index 9e5cbe0..19dc6b0 100644 --- a/lib/phone/tz.ex +++ b/lib/phone/tz.ex @@ -1,8 +1,10 @@ defmodule Phone.TZ do use Helper.Country - field :regex, ~r/^(255)()(.{9})/ - field :country, "Tanzania" - field :a2, "TZ" - field :a3, "TZA" - match :regex + + def regex, do: ~r/^(255)()(.{9})/ + def country, do: "Tanzania" + def a2, do: "TZ" + def a3, do: "TZA" + + matcher :regex, ["255"] end diff --git a/lib/phone/ua.ex b/lib/phone/ua.ex index 2009f1f..30eab1c 100644 --- a/lib/phone/ua.ex +++ b/lib/phone/ua.ex @@ -1,8 +1,10 @@ defmodule Phone.UA do use Helper.Country - field :regex, ~r/^(380)()(.{9})/ - field :country, "Ukraine" - field :a2, "UA" - field :a3, "UKR" - match :regex + + def regex, do: ~r/^(380)()(.{9})/ + def country, do: "Ukraine" + def a2, do: "UA" + def a3, do: "UKR" + + matcher :regex, ["380"] end diff --git a/lib/phone/ug.ex b/lib/phone/ug.ex index c87362e..3a5aa97 100644 --- a/lib/phone/ug.ex +++ b/lib/phone/ug.ex @@ -1,8 +1,10 @@ defmodule Phone.UG do use Helper.Country - field :regex, ~r/^(256)()(.{8})/ - field :country, "Uganda" - field :a2, "UG" - field :a3, "UGA" - match :regex + + def regex, do: ~r/^(256)()(.{8})/ + def country, do: "Uganda" + def a2, do: "UG" + def a3, do: "UGA" + + matcher :regex, ["256"] end diff --git a/lib/phone/uy.ex b/lib/phone/uy.ex index b176087..7382d21 100644 --- a/lib/phone/uy.ex +++ b/lib/phone/uy.ex @@ -1,8 +1,10 @@ defmodule Phone.UY do use Helper.Country - field :regex, ~r/^(598)()(.+)/ - field :country, "Uruguay" - field :a2, "UY" - field :a3, "URY" - match :regex + + def regex, do: ~r/^(598)()(.+)/ + def country, do: "Uruguay" + def a2, do: "UY" + def a3, do: "URY" + + matcher :regex, ["598"] end diff --git a/lib/phone/uz.ex b/lib/phone/uz.ex index 0b0cf2d..e292c1e 100644 --- a/lib/phone/uz.ex +++ b/lib/phone/uz.ex @@ -1,8 +1,10 @@ defmodule Phone.UZ do use Helper.Country - field :regex, ~r/^(998)()(.{9})/ - field :country, "Uzbekistan" - field :a2, "UZ" - field :a3, "UZB" - match :regex + + def regex, do: ~r/^(998)()(.{9})/ + def country, do: "Uzbekistan" + def a2, do: "UZ" + def a3, do: "UZB" + + matcher :regex, ["998"] end diff --git a/lib/phone/ve.ex b/lib/phone/ve.ex index a494b88..7cfc7ac 100644 --- a/lib/phone/ve.ex +++ b/lib/phone/ve.ex @@ -1,8 +1,10 @@ defmodule Phone.VE do use Helper.Country - field :regex, ~r/^(58)(.{3})(.{7})/ - field :country, "Venezuela" - field :a2, "VE" - field :a3, "VEN" - match :regex + + def regex, do: ~r/^(58)(.{3})(.{7})/ + def country, do: "Venezuela" + def a2, do: "VE" + def a3, do: "VEN" + + matcher :regex, ["58"] end diff --git a/lib/phone/vn.ex b/lib/phone/vn.ex index 3449dd0..5b30fe5 100644 --- a/lib/phone/vn.ex +++ b/lib/phone/vn.ex @@ -1,8 +1,10 @@ defmodule Phone.VN do use Helper.Country - field :regex, ~r/^(84)()(.+)/ - field :country, "Vietnam" - field :a2, "VN" - field :a3, "VNM" - match :regex + + def regex, do: ~r/^(84)()(.+)/ + def country, do: "Vietnam" + def a2, do: "VN" + def a3, do: "VNM" + + matcher :regex, ["84"] end diff --git a/lib/phone/vu.ex b/lib/phone/vu.ex index 7e0e7bf..6c6dbb5 100644 --- a/lib/phone/vu.ex +++ b/lib/phone/vu.ex @@ -1,8 +1,10 @@ defmodule Phone.VU do use Helper.Country - field :regex, ~r/^(678)()(.{5})/ - field :country, "Vanuatu" - field :a2, "VU" - field :a3, "VUT" - match :regex + + def regex, do: ~r/^(678)()(.{5})/ + def country, do: "Vanuatu" + def a2, do: "VU" + def a3, do: "VUT" + + matcher :regex, ["678"] end diff --git a/lib/phone/wf.ex b/lib/phone/wf.ex index 04327a2..551b1ff 100644 --- a/lib/phone/wf.ex +++ b/lib/phone/wf.ex @@ -1,8 +1,10 @@ defmodule Phone.WF do use Helper.Country - field :regex, ~r/^(681)()(.{6})/ - field :country, "Wallis and Futuna" - field :a2, "WF" - field :a3, "WLF" - match :regex + + def regex, do: ~r/^(681)()(.{6})/ + def country, do: "Wallis and Futuna" + def a2, do: "WF" + def a3, do: "WLF" + + matcher :regex, ["681"] end diff --git a/lib/phone/ws.ex b/lib/phone/ws.ex index 4423fab..913ba6c 100644 --- a/lib/phone/ws.ex +++ b/lib/phone/ws.ex @@ -1,8 +1,10 @@ defmodule Phone.WS do use Helper.Country - field :regex, ~r/^(685)()(.{6,7})/ - field :country, "Samoa" - field :a2, "WS" - field :a3, "WSM" - match :regex + + def regex, do: ~r/^(685)()(.{6,7})/ + def country, do: "Samoa" + def a2, do: "WS" + def a3, do: "WSM" + + matcher :regex, ["685"] end diff --git a/lib/phone/ye.ex b/lib/phone/ye.ex index 03ff59e..bd77a05 100644 --- a/lib/phone/ye.ex +++ b/lib/phone/ye.ex @@ -1,8 +1,10 @@ defmodule Phone.YE do use Helper.Country - field :regex, ~r/^(967)()(.+)/ - field :country, "Yemen" - field :a2, "YE" - field :a3, "YEM" - match :regex + + def regex, do: ~r/^(967)()(.+)/ + def country, do: "Yemen" + def a2, do: "YE" + def a3, do: "YEM" + + matcher :regex, ["967"] end diff --git a/lib/phone/za.ex b/lib/phone/za.ex index 291d170..a616474 100644 --- a/lib/phone/za.ex +++ b/lib/phone/za.ex @@ -1,8 +1,10 @@ defmodule Phone.ZA do use Helper.Country - field :regex, ~r/^(27)()(.{10})/ - field :country, "South Africa" - field :a2, "ZA" - field :a3, "ZAF" - match :regex + + def regex, do: ~r/^(27)()(.{10})/ + def country, do: "South Africa" + def a2, do: "ZA" + def a3, do: "ZAF" + + matcher :regex, ["27"] end diff --git a/lib/phone/zm.ex b/lib/phone/zm.ex index 56cfc66..224e1d6 100644 --- a/lib/phone/zm.ex +++ b/lib/phone/zm.ex @@ -1,8 +1,10 @@ defmodule Phone.ZM do use Helper.Country - field :regex, ~r/^(260)()(.{7})/ - field :country, "Zambia" - field :a2, "ZM" - field :a3, "ZMB" - match :regex + + def regex, do: ~r/^(260)()(.{7})/ + def country, do: "Zambia" + def a2, do: "ZM" + def a3, do: "ZMB" + + matcher :regex, ["260"] end diff --git a/lib/phone/zw.ex b/lib/phone/zw.ex index 8c5fcfc..de27030 100644 --- a/lib/phone/zw.ex +++ b/lib/phone/zw.ex @@ -1,8 +1,10 @@ defmodule Phone.ZW do use Helper.Country - field :regex, ~r/^(263)()(.+)/ - field :country, "Zimbabwe" - field :a2, "ZW" - field :a3, "ZWE" - match :regex + + def regex, do: ~r/^(263)()(.+)/ + def country, do: "Zimbabwe" + def a2, do: "ZW" + def a3, do: "ZWE" + + matcher :regex, ["263"] end diff --git a/mix.exs b/mix.exs index d2fb6df..da502ee 100644 --- a/mix.exs +++ b/mix.exs @@ -1,9 +1,9 @@ -defmodule Phonex.Mixfile do +defmodule Phone.Mixfile do use Mix.Project def project do [app: :phone, - version: "0.3.10", + version: "0.4.0", elixir: ">= 1.1.0", build_embedded: Mix.env == :prod, start_permanent: Mix.env == :prod, @@ -55,11 +55,12 @@ defmodule Phonex.Mixfile do defp deps do [ - {:coverex, "1.4.11", only: :test}, - {:credo, "0.5.3", only: :dev}, - {:earmark, "1.0.3", only: :dev}, - {:ex_doc, "0.14.5", only: :dev}, - {:inch_ex, "0.5.5", only: :docs} + {:coverex, "1.4.12", only: :test}, + {:credo, "0.7.2", only: :dev}, + {:earmark, "1.2.0", only: :dev}, + {:ex_doc, "0.15.0", only: :dev}, + {:benchfella, "0.3.4", only: :dev}, + {:inch_ex, "0.5.6", only: :docs} ] end end