From ec05cc74dd730a59a379580ea7c70fbb4d111e66 Mon Sep 17 00:00:00 2001 From: Flavio Date: Sat, 24 Mar 2018 14:33:38 -0300 Subject: [PATCH 1/3] Format code --- .formatter.exs | 21 ++ lib/helpers/area.ex | 40 +-- lib/helpers/country.ex | 55 ++-- lib/helpers/parser.ex | 503 ++++++++++++++--------------- lib/phone.ex | 39 +-- lib/phone/ad.ex | 2 +- lib/phone/ae.ex | 2 +- lib/phone/af.ex | 2 +- lib/phone/al.ex | 2 +- lib/phone/am.ex | 2 +- lib/phone/ao.ex | 2 +- lib/phone/ar.ex | 2 +- lib/phone/at.ex | 2 +- lib/phone/au.ex | 2 +- lib/phone/aw.ex | 2 +- lib/phone/az.ex | 2 +- lib/phone/ba.ex | 2 +- lib/phone/bd.ex | 2 +- lib/phone/be.ex | 2 +- lib/phone/bg.ex | 2 +- lib/phone/bh.ex | 2 +- lib/phone/bi.ex | 2 +- lib/phone/bj.ex | 2 +- lib/phone/bn.ex | 2 +- lib/phone/bo.ex | 2 +- lib/phone/br.ex | 35 +- lib/phone/br/ac.ex | 2 +- lib/phone/br/al.ex | 2 +- lib/phone/br/am.ex | 2 +- lib/phone/br/ap.ex | 2 +- lib/phone/br/ba.ex | 2 +- lib/phone/br/ce.ex | 2 +- lib/phone/br/df.ex | 2 +- lib/phone/br/es.ex | 2 +- lib/phone/br/go.ex | 2 +- lib/phone/br/ma.ex | 2 +- lib/phone/br/mg.ex | 2 +- lib/phone/br/ms.ex | 2 +- lib/phone/br/mt.ex | 2 +- lib/phone/br/pa.ex | 2 +- lib/phone/br/pb.ex | 2 +- lib/phone/br/pe.ex | 2 +- lib/phone/br/pi.ex | 2 +- lib/phone/br/pr.ex | 2 +- lib/phone/br/rj.ex | 2 +- lib/phone/br/rn.ex | 2 +- lib/phone/br/ro.ex | 2 +- lib/phone/br/rr.ex | 2 +- lib/phone/br/rs.ex | 2 +- lib/phone/br/sc.ex | 2 +- lib/phone/br/se.ex | 2 +- lib/phone/br/sp.ex | 2 +- lib/phone/br/to.ex | 2 +- lib/phone/bt.ex | 2 +- lib/phone/bw.ex | 2 +- lib/phone/by.ex | 2 +- lib/phone/bz.ex | 2 +- lib/phone/cd.ex | 2 +- lib/phone/cf.ex | 2 +- lib/phone/cg.ex | 2 +- lib/phone/ch.ex | 2 +- lib/phone/ci.ex | 2 +- lib/phone/ck.ex | 2 +- lib/phone/cl.ex | 2 +- lib/phone/cm.ex | 2 +- lib/phone/cn.ex | 2 +- lib/phone/co.ex | 2 +- lib/phone/countries.ex | 238 +++++++++++--- lib/phone/cr.ex | 2 +- lib/phone/cu.ex | 2 +- lib/phone/cv.ex | 2 +- lib/phone/cw.ex | 2 +- lib/phone/cy.ex | 2 +- lib/phone/cz.ex | 2 +- lib/phone/de.ex | 2 +- lib/phone/dj.ex | 2 +- lib/phone/dk.ex | 2 +- lib/phone/dz.ex | 2 +- lib/phone/ec.ex | 2 +- lib/phone/ee.ex | 2 +- lib/phone/eg.ex | 2 +- lib/phone/er.ex | 2 +- lib/phone/es.ex | 2 +- lib/phone/et.ex | 2 +- lib/phone/fi.ex | 2 +- lib/phone/fj.ex | 2 +- lib/phone/fm.ex | 2 +- lib/phone/fo.ex | 2 +- lib/phone/fr.ex | 2 +- lib/phone/ga.ex | 2 +- lib/phone/gb.ex | 2 +- lib/phone/ge.ex | 2 +- lib/phone/gf.ex | 2 +- lib/phone/gh.ex | 2 +- lib/phone/gi.ex | 2 +- lib/phone/gl.ex | 2 +- lib/phone/gm.ex | 2 +- lib/phone/gn.ex | 2 +- lib/phone/gq.ex | 2 +- lib/phone/gr.ex | 2 +- lib/phone/gt.ex | 2 +- lib/phone/gw.ex | 2 +- lib/phone/gy.ex | 2 +- lib/phone/hk.ex | 2 +- lib/phone/hn.ex | 2 +- lib/phone/hr.ex | 2 +- lib/phone/ht.ex | 2 +- lib/phone/hu.ex | 2 +- lib/phone/id.ex | 2 +- lib/phone/ie.ex | 2 +- lib/phone/il.ex | 2 +- lib/phone/in.ex | 2 +- lib/phone/io.ex | 2 +- lib/phone/iq.ex | 2 +- lib/phone/ir.ex | 2 +- lib/phone/is.ex | 2 +- lib/phone/it.ex | 2 +- lib/phone/jo.ex | 2 +- lib/phone/jp.ex | 2 +- lib/phone/ke.ex | 2 +- lib/phone/kg.ex | 2 +- lib/phone/kh.ex | 2 +- lib/phone/ki.ex | 2 +- lib/phone/km.ex | 2 +- lib/phone/kp.ex | 2 +- lib/phone/kr.ex | 2 +- lib/phone/kw.ex | 2 +- lib/phone/kz.ex | 2 +- lib/phone/la.ex | 2 +- lib/phone/lb.ex | 2 +- lib/phone/li.ex | 2 +- lib/phone/lk.ex | 2 +- lib/phone/lr.ex | 2 +- lib/phone/ls.ex | 2 +- lib/phone/lt.ex | 2 +- lib/phone/lu.ex | 2 +- lib/phone/lv.ex | 2 +- lib/phone/ly.ex | 2 +- lib/phone/ma.ex | 2 +- lib/phone/mc.ex | 2 +- lib/phone/md.ex | 2 +- lib/phone/me.ex | 2 +- lib/phone/mg.ex | 2 +- lib/phone/mh.ex | 2 +- lib/phone/mk.ex | 2 +- lib/phone/ml.ex | 2 +- lib/phone/mm.ex | 2 +- lib/phone/mn.ex | 2 +- lib/phone/mo.ex | 2 +- lib/phone/mq.ex | 2 +- lib/phone/mr.ex | 2 +- lib/phone/mt.ex | 2 +- lib/phone/mu.ex | 2 +- lib/phone/mv.ex | 2 +- lib/phone/mw.ex | 2 +- lib/phone/mx.ex | 2 +- lib/phone/my.ex | 2 +- lib/phone/mz.ex | 2 +- lib/phone/na.ex | 2 +- lib/phone/nanp.ex | 35 +- lib/phone/nanp/ag.ex | 2 +- lib/phone/nanp/ai.ex | 2 +- lib/phone/nanp/as.ex | 2 +- lib/phone/nanp/bb.ex | 2 +- lib/phone/nanp/bm.ex | 2 +- lib/phone/nanp/bs.ex | 2 +- lib/phone/nanp/ca.ex | 16 +- lib/phone/nanp/ca/ab.ex | 2 +- lib/phone/nanp/ca/bc.ex | 2 +- lib/phone/nanp/ca/mb.ex | 2 +- lib/phone/nanp/ca/nb.ex | 2 +- lib/phone/nanp/ca/nl.ex | 2 +- lib/phone/nanp/ca/ns_and_pe.ex | 2 +- lib/phone/nanp/ca/on.ex | 18 +- lib/phone/nanp/ca/qc.ex | 2 +- lib/phone/nanp/ca/sk.ex | 2 +- lib/phone/nanp/ca/territory.ex | 2 +- lib/phone/nanp/dm.ex | 2 +- lib/phone/nanp/do.ex | 2 +- lib/phone/nanp/gd.ex | 2 +- lib/phone/nanp/gu.ex | 2 +- lib/phone/nanp/jm.ex | 2 +- lib/phone/nanp/kn.ex | 2 +- lib/phone/nanp/ky.ex | 2 +- lib/phone/nanp/lc.ex | 2 +- lib/phone/nanp/mp.ex | 2 +- lib/phone/nanp/ms.ex | 2 +- lib/phone/nanp/pr.ex | 2 +- lib/phone/nanp/sx.ex | 2 +- lib/phone/nanp/tc.ex | 2 +- lib/phone/nanp/toll_free.ex | 2 +- lib/phone/nanp/tt.ex | 2 +- lib/phone/nanp/us.ex | 66 +++- lib/phone/nanp/us/ak.ex | 2 +- lib/phone/nanp/us/al.ex | 2 +- lib/phone/nanp/us/ar.ex | 2 +- lib/phone/nanp/us/az.ex | 2 +- lib/phone/nanp/us/ca.ex | 44 ++- lib/phone/nanp/us/co.ex | 2 +- lib/phone/nanp/us/ct.ex | 2 +- lib/phone/nanp/us/dc.ex | 2 +- lib/phone/nanp/us/de.ex | 2 +- lib/phone/nanp/us/fl.ex | 25 +- lib/phone/nanp/us/ga.ex | 2 +- lib/phone/nanp/us/hi.ex | 2 +- lib/phone/nanp/us/ia.ex | 2 +- lib/phone/nanp/us/id.ex | 2 +- lib/phone/nanp/us/il.ex | 17 +- lib/phone/nanp/us/in.ex | 2 +- lib/phone/nanp/us/ks.ex | 2 +- lib/phone/nanp/us/ky.ex | 2 +- lib/phone/nanp/us/la.ex | 2 +- lib/phone/nanp/us/ma.ex | 2 +- lib/phone/nanp/us/md.ex | 2 +- lib/phone/nanp/us/me.ex | 2 +- lib/phone/nanp/us/mi.ex | 16 +- lib/phone/nanp/us/mn.ex | 2 +- lib/phone/nanp/us/mo.ex | 2 +- lib/phone/nanp/us/ms.ex | 2 +- lib/phone/nanp/us/mt.ex | 2 +- lib/phone/nanp/us/nc.ex | 2 +- lib/phone/nanp/us/nd.ex | 2 +- lib/phone/nanp/us/ne.ex | 2 +- lib/phone/nanp/us/nh.ex | 2 +- lib/phone/nanp/us/nj.ex | 2 +- lib/phone/nanp/us/nm.ex | 2 +- lib/phone/nanp/us/nv.ex | 2 +- lib/phone/nanp/us/ny.ex | 29 +- lib/phone/nanp/us/oh.ex | 16 +- lib/phone/nanp/us/ok.ex | 2 +- lib/phone/nanp/us/or.ex | 2 +- lib/phone/nanp/us/pa.ex | 17 +- lib/phone/nanp/us/ri.ex | 2 +- lib/phone/nanp/us/sc.ex | 2 +- lib/phone/nanp/us/sd.ex | 2 +- lib/phone/nanp/us/tn.ex | 2 +- lib/phone/nanp/us/tx.ex | 37 ++- lib/phone/nanp/us/ut.ex | 2 +- lib/phone/nanp/us/va.ex | 2 +- lib/phone/nanp/us/vt.ex | 2 +- lib/phone/nanp/us/wa.ex | 2 +- lib/phone/nanp/us/wi.ex | 2 +- lib/phone/nanp/us/wv.ex | 2 +- lib/phone/nanp/us/wy.ex | 2 +- lib/phone/nanp/vc.ex | 2 +- lib/phone/nanp/vg.ex | 2 +- lib/phone/nanp/vi.ex | 2 +- lib/phone/nc.ex | 2 +- lib/phone/ne.ex | 2 +- lib/phone/ng.ex | 2 +- lib/phone/ni.ex | 2 +- lib/phone/nl.ex | 2 +- lib/phone/no.ex | 2 +- lib/phone/np.ex | 2 +- lib/phone/nr.ex | 2 +- lib/phone/nu.ex | 2 +- lib/phone/nz.ex | 2 +- lib/phone/om.ex | 2 +- lib/phone/pa.ex | 2 +- lib/phone/pe.ex | 2 +- lib/phone/pf.ex | 2 +- lib/phone/pg.ex | 2 +- lib/phone/ph.ex | 2 +- lib/phone/pk.ex | 2 +- lib/phone/pl.ex | 2 +- lib/phone/pm.ex | 2 +- lib/phone/ps.ex | 2 +- lib/phone/pt.ex | 2 +- lib/phone/pw.ex | 2 +- lib/phone/py.ex | 2 +- lib/phone/qa.ex | 2 +- lib/phone/ro.ex | 2 +- lib/phone/rs.ex | 2 +- lib/phone/ru.ex | 2 +- lib/phone/rw.ex | 2 +- lib/phone/sa.ex | 2 +- lib/phone/sb.ex | 2 +- lib/phone/sc.ex | 2 +- lib/phone/sd.ex | 2 +- lib/phone/se.ex | 2 +- lib/phone/sg.ex | 2 +- lib/phone/sh.ex | 2 +- lib/phone/si.ex | 2 +- lib/phone/sk.ex | 2 +- lib/phone/sl.ex | 2 +- lib/phone/sm.ex | 2 +- lib/phone/sn.ex | 2 +- lib/phone/so.ex | 2 +- lib/phone/sr.ex | 2 +- lib/phone/ss.ex | 2 +- lib/phone/st.ex | 2 +- lib/phone/sv.ex | 2 +- lib/phone/sy.ex | 2 +- lib/phone/sz.ex | 2 +- lib/phone/td.ex | 2 +- lib/phone/tg.ex | 2 +- lib/phone/th.ex | 2 +- lib/phone/tj.ex | 2 +- lib/phone/tk.ex | 2 +- lib/phone/tl.ex | 2 +- lib/phone/tm.ex | 2 +- lib/phone/tn.ex | 2 +- lib/phone/to.ex | 2 +- lib/phone/tr.ex | 2 +- lib/phone/tv.ex | 2 +- lib/phone/tw.ex | 2 +- lib/phone/tz.ex | 2 +- lib/phone/ua.ex | 2 +- lib/phone/ug.ex | 2 +- lib/phone/uy.ex | 2 +- lib/phone/uz.ex | 2 +- lib/phone/ve.ex | 2 +- lib/phone/vn.ex | 2 +- lib/phone/vu.ex | 2 +- lib/phone/wf.ex | 2 +- lib/phone/ws.ex | 2 +- lib/phone/ye.ex | 2 +- lib/phone/za.ex | 2 +- lib/phone/zm.ex | 2 +- lib/phone/zw.ex | 2 +- mix.exs | 23 +- test/phone/a_countries/ad_test.exs | 35 +- test/phone/a_countries/ae_test.exs | 35 +- test/phone/a_countries/af_test.exs | 35 +- test/phone/a_countries/al_test.exs | 35 +- test/phone/a_countries/am_test.exs | 35 +- test/phone/a_countries/ao_test.exs | 35 +- test/phone/a_countries/ar_test.exs | 35 +- test/phone/a_countries/at_test.exs | 35 +- test/phone/a_countries/au_test.exs | 35 +- test/phone/a_countries/aw_test.exs | 35 +- test/phone/a_countries/az_test.exs | 35 +- test/phone/b_countries/ba_test.exs | 35 +- test/phone/b_countries/bd_test.exs | 35 +- test/phone/b_countries/be_test.exs | 35 +- test/phone/b_countries/bg_test.exs | 35 +- test/phone/b_countries/bh_test.exs | 35 +- test/phone/b_countries/bi_test.exs | 35 +- test/phone/b_countries/bj_test.exs | 35 +- test/phone/b_countries/bn_test.exs | 35 +- test/phone/b_countries/bo_test.exs | 35 +- test/phone/b_countries/br_test.exs | 110 ++++--- test/phone/b_countries/bt_test.exs | 35 +- test/phone/b_countries/bw_test.exs | 35 +- test/phone/b_countries/by_test.exs | 35 +- test/phone/b_countries/bz_test.exs | 51 ++- test/phone/c_countries/ca_test.exs | 87 ++--- test/phone/countries_test.exs | 284 ++++++++++++---- test/phone/nanp_test.exs | 101 +++--- test/phone/u_countries/us_test.exs | 141 +++++--- test/phone_test.exs | 62 ++-- 351 files changed, 2100 insertions(+), 1433 deletions(-) create mode 100644 .formatter.exs diff --git a/.formatter.exs b/.formatter.exs new file mode 100644 index 0000000..d001726 --- /dev/null +++ b/.formatter.exs @@ -0,0 +1,21 @@ +[ + inputs: [ + "mix.exs", + "{config,lib,priv,test,bench}/**/*.{ex,exs}", + ], + + locals_without_parens: [ + # Formatter tests + assert_format: 2, + assert_format: 3, + assert_same: 1, + assert_same: 2, + + # Errors tests + assert_eval_raise: 3, + + # Mix tests + in_fixture: 2, + in_tmp: 2 + ] +] diff --git a/lib/helpers/area.ex b/lib/helpers/area.ex index 3f34cda..5e54e3e 100644 --- a/lib/helpers/area.ex +++ b/lib/helpers/area.ex @@ -9,18 +9,18 @@ defmodule Helper.Area do def area_type, do: "" def area_abbreviation, do: "" - defoverridable [regex: 0, area_name: 0, area_type: 0, area_abbreviation: 0] + defoverridable regex: 0, area_name: 0, area_type: 0, area_abbreviation: 0 def builder(number) do [_ | country] = __MODULE__ - |> Module.split - |> Enum.reverse + |> Module.split() + |> Enum.reverse() country = country - |> Enum.reverse - |> Module.concat + |> Enum.reverse() + |> Module.concat() [[_, code, area, number]] = Regex.scan(regex(), number) @@ -40,19 +40,23 @@ defmodule Helper.Area do end defp generate_codes(codes) do - [quote do - def codes, do: unquote(codes) - end] + [ + quote do + def codes, do: unquote(codes) + end + ] end defp generate_errors do - [quote do - def build(_number), do: {:error, "Not a valid phone number."} + [ + quote do + def build(_number), do: {:error, "Not a valid phone number."} - def build!(_number), do: raise ArgumentError, message: "Not a valid phone number." + def build!(_number), do: raise(ArgumentError, message: "Not a valid phone number.") - def match?(_number), do: false - end] + def match?(_number), do: false + end + ] end defp generate_matcher(code) do @@ -80,13 +84,9 @@ defmodule Helper.Area do end defmacro matcher(codes) do - generate_codes(codes) - ++ - Enum.map(codes, - fn code -> + generate_codes(codes) ++ + Enum.map(codes, fn code -> generate_matcher(code) - end) - ++ - generate_errors() + end) ++ generate_errors() end end diff --git a/lib/helpers/country.ex b/lib/helpers/country.ex index 51ca101..899bec3 100644 --- a/lib/helpers/country.ex +++ b/lib/helpers/country.ex @@ -9,7 +9,7 @@ defmodule Helper.Country do def a2, do: "" def a3, do: "" - defoverridable [regex: 0, country: 0, a2: 0, a3: 0] + defoverridable regex: 0, country: 0, a2: 0, a3: 0 def builder(number) do [[_, code, area, number]] = Regex.scan(regex(), number) @@ -27,19 +27,23 @@ defmodule Helper.Country do end defp generate_codes(codes) do - [quote do - def codes, do: unquote(codes) - end] + [ + quote do + def codes, do: unquote(codes) + end + ] end defp generate_errors do - [quote do - def match?(_number), do: false + [ + quote do + def match?(_number), do: false - def build!(_number), do: raise ArgumentError, "Not a valid phone number." + def build!(_number), do: raise(ArgumentError, "Not a valid phone number.") - def build(_number), do: {:error, "Not a valid phone number."} - end] + def build(_number), do: {:error, "Not a valid phone number."} + end + ] end def generate_matcher(:regex, code) do @@ -83,34 +87,25 @@ defmodule Helper.Country do end defmacro matcher(:regex, codes) do - generate_codes(codes) - ++ - Enum.map(codes, - fn code -> + generate_codes(codes) ++ + Enum.map(codes, fn code -> generate_matcher(:regex, code) - end) - ++ - generate_errors() + end) ++ generate_errors() end defmacro matcher(:modules, modules) do - modules = Enum.map(modules, &(Macro.expand(&1, __CALLER__))) + modules = Enum.map(modules, &Macro.expand(&1, __CALLER__)) (modules - |> Enum.reduce([], fn m, acc -> acc ++ m.codes end) - |> generate_codes) - ++ - Enum.map(modules, - fn module -> - Enum.map(module.codes, - fn code -> - generate_matcher(:modules, module, code) - end) - end) - ++ - generate_errors() + |> Enum.reduce([], fn m, acc -> acc ++ m.codes end) + |> generate_codes) ++ + Enum.map(modules, fn module -> + Enum.map(module.codes, fn code -> + generate_matcher(:modules, module, code) + end) + end) ++ generate_errors() end defmacro matcher(_, _), - do: raise ArgumentError, "You can only match against :regex or :modules" + do: raise(ArgumentError, "You can only match against :regex or :modules") end diff --git a/lib/helpers/parser.ex b/lib/helpers/parser.ex index 6448776..a81f422 100644 --- a/lib/helpers/parser.ex +++ b/lib/helpers/parser.ex @@ -3,7 +3,6 @@ defmodule Helper.Parser do defmacro parser(country, code) do quote do - @doc """ Same as `parse/1` but the number doesn't have the international code, instead you specify country as an atom with two-letters code. @@ -74,257 +73,257 @@ defmodule Helper.Parser do defmacro country_parser do quote do - parser :ad, "376" - parser :ae, "971" - parser :af, "93" - parser :al, "355" - parser :am, "374" - parser :ao, "244" - parser :ar, "54" - parser :at, "43" - parser :aw, "297" - parser :az, "994" - - parser :ba, "387" - parser :bd, "880" - parser :be, "32" - parser :bg, "359" - parser :bh, "973" - parser :bi, "257" - parser :bj, "229" - parser :bn, "673" - parser :bo, "591" - parser :br, "55" - parser :bt, "975" - parser :bw, "267" - parser :by, "375" - parser :bz, "501" - - parser :cd, "243" - parser :cf, "236" - parser :cg, "242" - parser :ch, "41" - parser :ci, "225" - parser :ck, "682" - parser :cl, "56" - parser :cm, "237" - parser :cn, "86" - parser :co, "57" - parser :cr, "506" - parser :cu, "53" - parser :cv, "238" - parser :cw, "599" - parser :cy, "357" - parser :cz, "420" - - parser :de, "49" - parser :dj, "253" - parser :dk, "45" - parser :dz, "213" - - parser :ec, "593" - parser :ee, "372" - parser :eg, "20" - parser :er, "291" - parser :es, "34" - parser :et, "251" - - parser :fi, "358" - parser :fj, "679" - parser :fm, "691" - parser :fo, "298" - parser :fr, "33" - - parser :ga, "241" - parser :gb, "44" - parser :ge, "995" - parser :gf, "594" - parser :gh, "233" - parser :gi, "350" - parser :gl, "299" - parser :gm, "220" - parser :gn, "224" - parser :gq, "240" - parser :gt, "502" - parser :gw, "245" - parser :gy, "592" - - parser :gr, "30" - parser :uk, "30" - - parser :hk, "852" - parser :hn, "504" - parser :hr, "385" - parser :ht, "509" - parser :hu, "36" - - parser :id, "62" - parser :ie, "353" - parser :il, "972" - parser :in, "91" - parser :io, "246" - parser :iq, "964" - parser :ir, "98" - parser :is, "353" - parser :it, "39" - - parser :jo, "962" - parser :jp, "81" - - parser :ke, "254" - parser :kg, "996" - parser :kh, "855" - parser :ki, "686" - parser :km, "269" - parser :kp, "850" - parser :kr, "82" - parser :kw, "965" - parser :kz, "7" - - parser :la, "856" - parser :lb, "961" - parser :li, "423" - parser :lk, "94" - parser :lr, "231" - parser :ls, "266" - parser :lt, "370" - parser :lu, "352" - parser :lv, "371" - parser :ly, "218" - - parser :ma, "212" - parser :mc, "377" - parser :md, "373" - parser :me, "382" - parser :mg, "261" - parser :mh, "692" - parser :mk, "389" - parser :ml, "223" - parser :mm, "95" - parser :mn, "976" - parser :mo, "853" - parser :mq, "596" - parser :mr, "222" - parser :mt, "356" - parser :mu, "230" - parser :mv, "960" - parser :mw, "265" - parser :mx, "52" - parser :my, "60" - parser :mz, "258" - - parser :nanp, "1" - parser :ag, "1" - parser :ai, "1" - parser :as, "1" - parser :bb, "1" - parser :bm, "1" - parser :bs, "1" - parser :ca, "1" - parser :dm, "1" - parser :do, "1" - parser :gd, "1" - parser :gu, "1" - parser :jm, "1" - parser :kn, "1" - parser :ky, "1" - parser :lc, "1" - parser :mp, "1" - parser :ms, "1" - parser :pr, "1" - parser :sx, "1" - parser :tc, "1" - parser :tt, "1" - parser :us, "1" - parser :vc, "1" - parser :vg, "1" - parser :vi, "1" - - parser :na, "264" - parser :nc, "687" - parser :ne, "227" - parser :ng, "234" - parser :ni, "505" - parser :nl, "31" - parser :no, "47" - parser :np, "977" - parser :nr, "674" - parser :nu, "683" - parser :nz, "64" - - parser :om, "968" - - parser :pa, "507" - parser :pe, "51" - parser :pf, "689" - parser :pg, "675" - parser :ph, "63" - parser :pk, "92" - parser :pl, "48" - parser :pm, "508" - parser :ps, "970" - parser :pt, "351" - parser :pw, "680" - parser :py, "595" - - parser :qa, "974" - - parser :ro, "40" - parser :rs, "381" - parser :ru, "7" - parser :rw, "250" - - parser :sa, "966" - parser :sb, "677" - parser :sc, "248" - parser :sd, "249" - parser :se, "46" - parser :sg, "65" - parser :sh, "290" - parser :si, "386" - parser :sk, "421" - parser :sl, "232" - parser :sm, "378" - parser :sn, "221" - parser :so, "252" - parser :sr, "597" - parser :ss, "211" - parser :st, "239" - parser :sv, "503" - parser :sy, "963" - parser :sz, "268" - - parser :td, "235" - parser :tg, "228" - parser :th, "66" - parser :tj, "992" - parser :tk, "690" - parser :tl, "670" - parser :tm, "993" - parser :tn, "216" - parser :to, "676" - parser :tr, "90" - parser :tv, "688" - parser :tw, "886" - parser :tz, "255" - - parser :ua, "380" - parser :ug, "256" - parser :uy, "598" - parser :uz, "998" - - parser :ve, "58" - parser :vn, "84" - parser :vu, "678" - - parser :wf, "681" - parser :ws, "685" - - parser :ye, "967" - - parser :za, "27" - parser :zm, "260" - parser :zw, "263" + parser(:ad, "376") + parser(:ae, "971") + parser(:af, "93") + parser(:al, "355") + parser(:am, "374") + parser(:ao, "244") + parser(:ar, "54") + parser(:at, "43") + parser(:aw, "297") + parser(:az, "994") + + parser(:ba, "387") + parser(:bd, "880") + parser(:be, "32") + parser(:bg, "359") + parser(:bh, "973") + parser(:bi, "257") + parser(:bj, "229") + parser(:bn, "673") + parser(:bo, "591") + parser(:br, "55") + parser(:bt, "975") + parser(:bw, "267") + parser(:by, "375") + parser(:bz, "501") + + parser(:cd, "243") + parser(:cf, "236") + parser(:cg, "242") + parser(:ch, "41") + parser(:ci, "225") + parser(:ck, "682") + parser(:cl, "56") + parser(:cm, "237") + parser(:cn, "86") + parser(:co, "57") + parser(:cr, "506") + parser(:cu, "53") + parser(:cv, "238") + parser(:cw, "599") + parser(:cy, "357") + parser(:cz, "420") + + parser(:de, "49") + parser(:dj, "253") + parser(:dk, "45") + parser(:dz, "213") + + parser(:ec, "593") + parser(:ee, "372") + parser(:eg, "20") + parser(:er, "291") + parser(:es, "34") + parser(:et, "251") + + parser(:fi, "358") + parser(:fj, "679") + parser(:fm, "691") + parser(:fo, "298") + parser(:fr, "33") + + parser(:ga, "241") + parser(:gb, "44") + parser(:ge, "995") + parser(:gf, "594") + parser(:gh, "233") + parser(:gi, "350") + parser(:gl, "299") + parser(:gm, "220") + parser(:gn, "224") + parser(:gq, "240") + parser(:gt, "502") + parser(:gw, "245") + parser(:gy, "592") + + parser(:gr, "30") + parser(:uk, "30") + + parser(:hk, "852") + parser(:hn, "504") + parser(:hr, "385") + parser(:ht, "509") + parser(:hu, "36") + + parser(:id, "62") + parser(:ie, "353") + parser(:il, "972") + parser(:in, "91") + parser(:io, "246") + parser(:iq, "964") + parser(:ir, "98") + parser(:is, "353") + parser(:it, "39") + + parser(:jo, "962") + parser(:jp, "81") + + parser(:ke, "254") + parser(:kg, "996") + parser(:kh, "855") + parser(:ki, "686") + parser(:km, "269") + parser(:kp, "850") + parser(:kr, "82") + parser(:kw, "965") + parser(:kz, "7") + + parser(:la, "856") + parser(:lb, "961") + parser(:li, "423") + parser(:lk, "94") + parser(:lr, "231") + parser(:ls, "266") + parser(:lt, "370") + parser(:lu, "352") + parser(:lv, "371") + parser(:ly, "218") + + parser(:ma, "212") + parser(:mc, "377") + parser(:md, "373") + parser(:me, "382") + parser(:mg, "261") + parser(:mh, "692") + parser(:mk, "389") + parser(:ml, "223") + parser(:mm, "95") + parser(:mn, "976") + parser(:mo, "853") + parser(:mq, "596") + parser(:mr, "222") + parser(:mt, "356") + parser(:mu, "230") + parser(:mv, "960") + parser(:mw, "265") + parser(:mx, "52") + parser(:my, "60") + parser(:mz, "258") + + parser(:nanp, "1") + parser(:ag, "1") + parser(:ai, "1") + parser(:as, "1") + parser(:bb, "1") + parser(:bm, "1") + parser(:bs, "1") + parser(:ca, "1") + parser(:dm, "1") + parser(:do, "1") + parser(:gd, "1") + parser(:gu, "1") + parser(:jm, "1") + parser(:kn, "1") + parser(:ky, "1") + parser(:lc, "1") + parser(:mp, "1") + parser(:ms, "1") + parser(:pr, "1") + parser(:sx, "1") + parser(:tc, "1") + parser(:tt, "1") + parser(:us, "1") + parser(:vc, "1") + parser(:vg, "1") + parser(:vi, "1") + + parser(:na, "264") + parser(:nc, "687") + parser(:ne, "227") + parser(:ng, "234") + parser(:ni, "505") + parser(:nl, "31") + parser(:no, "47") + parser(:np, "977") + parser(:nr, "674") + parser(:nu, "683") + parser(:nz, "64") + + parser(:om, "968") + + parser(:pa, "507") + parser(:pe, "51") + parser(:pf, "689") + parser(:pg, "675") + parser(:ph, "63") + parser(:pk, "92") + parser(:pl, "48") + parser(:pm, "508") + parser(:ps, "970") + parser(:pt, "351") + parser(:pw, "680") + parser(:py, "595") + + parser(:qa, "974") + + parser(:ro, "40") + parser(:rs, "381") + parser(:ru, "7") + parser(:rw, "250") + + parser(:sa, "966") + parser(:sb, "677") + parser(:sc, "248") + parser(:sd, "249") + parser(:se, "46") + parser(:sg, "65") + parser(:sh, "290") + parser(:si, "386") + parser(:sk, "421") + parser(:sl, "232") + parser(:sm, "378") + parser(:sn, "221") + parser(:so, "252") + parser(:sr, "597") + parser(:ss, "211") + parser(:st, "239") + parser(:sv, "503") + parser(:sy, "963") + parser(:sz, "268") + + parser(:td, "235") + parser(:tg, "228") + parser(:th, "66") + parser(:tj, "992") + parser(:tk, "690") + parser(:tl, "670") + parser(:tm, "993") + parser(:tn, "216") + parser(:to, "676") + parser(:tr, "90") + parser(:tv, "688") + parser(:tw, "886") + parser(:tz, "255") + + parser(:ua, "380") + parser(:ug, "256") + parser(:uy, "598") + parser(:uz, "998") + + parser(:ve, "58") + parser(:vn, "84") + parser(:vu, "678") + + parser(:wf, "681") + parser(:ws, "685") + + parser(:ye, "967") + + parser(:za, "27") + parser(:zm, "260") + parser(:zw, "263") end end end diff --git a/lib/phone.ex b/lib/phone.ex index 53b0ba4..dd36b3f 100644 --- a/lib/phone.ex +++ b/lib/phone.ex @@ -29,14 +29,14 @@ defmodule Phone do ``` """ - @spec parse(String.t) :: {:ok, Map.t} + @spec parse(String.t()) :: {:ok, Map.t()} def parse(number) when is_bitstring(number) do number |> prepare_number - |> Phone.Countries.build + |> Phone.Countries.build() end - @spec parse(pos_integer) :: {:ok, Map.t} + @spec parse(pos_integer) :: {:ok, Map.t()} def parse(number) when is_integer(number) do number = Integer.to_string(number) parse(number) @@ -51,7 +51,7 @@ defmodule Phone do number = clear(number) try do - number |> String.to_integer |> Integer.to_string + number |> String.to_integer() |> Integer.to_string() rescue _ -> "" end @@ -60,7 +60,7 @@ defmodule Phone do @doc false defp clear(number) when is_bitstring(number) do number - |> String.graphemes + |> String.graphemes() |> Enum.filter(fn n -> valid_char(n) end) |> Enum.join("") end @@ -91,18 +91,21 @@ defmodule Phone do ``` """ - @spec parse!(String.t) :: Map.t + @spec parse!(String.t()) :: 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 + + number = + try do + number |> String.to_integer() |> Integer.to_string() + rescue + _ -> "" + end + Phone.Countries.build!(number) end - @spec parse!(pos_integer) :: Map.t + @spec parse!(pos_integer) :: Map.t() def parse!(number) when is_integer(number) do number = Integer.to_string(number) parse!(number) @@ -112,10 +115,10 @@ defmodule Phone do raise ArgumentError, message: "Not a valid parameter, only string or integer." end - @spec parse(String.t, Atom.t) :: {:ok, Map.t} - @spec parse(pos_integer, Atom.t) :: {:ok, Map.t} - @spec parse!(String.t, Atom.t) :: Map.t - @spec parse!(pos_integer, Atom.t) :: Map.t + @spec parse(String.t(), Atom.t()) :: {:ok, Map.t()} + @spec parse(pos_integer, Atom.t()) :: {:ok, Map.t()} + @spec parse!(String.t(), Atom.t()) :: Map.t() + @spec parse!(pos_integer, Atom.t()) :: Map.t() country_parser() @doc """ @@ -136,11 +139,11 @@ defmodule Phone do ``` """ - @spec parse(String.t) :: boolean + @spec parse(String.t()) :: boolean def valid?(number) when is_bitstring(number) do number |> prepare_number - |> Phone.Countries.match? + |> Phone.Countries.match?() end @spec parse(pos_integer) :: boolean diff --git a/lib/phone/ad.ex b/lib/phone/ad.ex index cd28382..35661d6 100644 --- a/lib/phone/ad.ex +++ b/lib/phone/ad.ex @@ -8,5 +8,5 @@ defmodule Phone.AD do def a2, do: "AD" def a3, do: "AND" - matcher :regex, ["376"] + matcher(:regex, ["376"]) end diff --git a/lib/phone/ae.ex b/lib/phone/ae.ex index c98664e..f39b4e8 100644 --- a/lib/phone/ae.ex +++ b/lib/phone/ae.ex @@ -8,5 +8,5 @@ defmodule Phone.AE do def a2, do: "AE" def a3, do: "ARE" - matcher :regex, ["971"] + matcher(:regex, ["971"]) end diff --git a/lib/phone/af.ex b/lib/phone/af.ex index 3c25b19..c280076 100644 --- a/lib/phone/af.ex +++ b/lib/phone/af.ex @@ -8,5 +8,5 @@ defmodule Phone.AF do def a2, do: "AF" def a3, do: "AFG" - matcher :regex, ["93"] + matcher(:regex, ["93"]) end diff --git a/lib/phone/al.ex b/lib/phone/al.ex index e528bfe..24e09ce 100644 --- a/lib/phone/al.ex +++ b/lib/phone/al.ex @@ -8,5 +8,5 @@ defmodule Phone.AL do def a2, do: "AL" def a3, do: "ALB" - matcher :regex, ["355"] + matcher(:regex, ["355"]) end diff --git a/lib/phone/am.ex b/lib/phone/am.ex index 8278642..01d8b24 100644 --- a/lib/phone/am.ex +++ b/lib/phone/am.ex @@ -8,5 +8,5 @@ defmodule Phone.AM do def a2, do: "AM" def a3, do: "ARM" - matcher :regex, ["374"] + matcher(:regex, ["374"]) end diff --git a/lib/phone/ao.ex b/lib/phone/ao.ex index 56492f7..ef0982c 100644 --- a/lib/phone/ao.ex +++ b/lib/phone/ao.ex @@ -8,5 +8,5 @@ defmodule Phone.AO do def a2, do: "AO" def a3, do: "AGO" - matcher :regex, ["244"] + matcher(:regex, ["244"]) end diff --git a/lib/phone/ar.ex b/lib/phone/ar.ex index f0be263..63c9770 100644 --- a/lib/phone/ar.ex +++ b/lib/phone/ar.ex @@ -8,5 +8,5 @@ defmodule Phone.AR do def a2, do: "AR" def a3, do: "ARG" - matcher :regex, ["54"] + matcher(:regex, ["54"]) end diff --git a/lib/phone/at.ex b/lib/phone/at.ex index 6a9f8ff..392561c 100644 --- a/lib/phone/at.ex +++ b/lib/phone/at.ex @@ -8,5 +8,5 @@ defmodule Phone.AT do def a2, do: "AT" def a3, do: "AUT" - matcher :regex, ["43"] + matcher(:regex, ["43"]) end diff --git a/lib/phone/au.ex b/lib/phone/au.ex index 3db9d87..7c82d61 100644 --- a/lib/phone/au.ex +++ b/lib/phone/au.ex @@ -8,5 +8,5 @@ defmodule Phone.AU do def a2, do: "AU" def a3, do: "AUS" - matcher :regex, ["611", "612", "613", "614", "617", "618"] + matcher(:regex, ["611", "612", "613", "614", "617", "618"]) end diff --git a/lib/phone/aw.ex b/lib/phone/aw.ex index 9a1ba84..bdc0bcf 100644 --- a/lib/phone/aw.ex +++ b/lib/phone/aw.ex @@ -8,5 +8,5 @@ defmodule Phone.AW do def a2, do: "AW" def a3, do: "ABW" - matcher :regex, ["297"] + matcher(:regex, ["297"]) end diff --git a/lib/phone/az.ex b/lib/phone/az.ex index 20e74ae..6082681 100644 --- a/lib/phone/az.ex +++ b/lib/phone/az.ex @@ -8,5 +8,5 @@ defmodule Phone.AZ do def a2, do: "AZ" def a3, do: "AZE" - matcher :regex, ["994"] + matcher(:regex, ["994"]) end diff --git a/lib/phone/ba.ex b/lib/phone/ba.ex index 030b017..5bfd8cb 100644 --- a/lib/phone/ba.ex +++ b/lib/phone/ba.ex @@ -8,5 +8,5 @@ defmodule Phone.BA do def a2, do: "BA" def a3, do: "BIH" - matcher :regex, ["387"] + matcher(:regex, ["387"]) end diff --git a/lib/phone/bd.ex b/lib/phone/bd.ex index 5aeb570..8ffe89c 100644 --- a/lib/phone/bd.ex +++ b/lib/phone/bd.ex @@ -8,5 +8,5 @@ defmodule Phone.BD do def a2, do: "BD" def a3, do: "BGD" - matcher :regex, ["880"] + matcher(:regex, ["880"]) end diff --git a/lib/phone/be.ex b/lib/phone/be.ex index 4c24097..961c9f8 100644 --- a/lib/phone/be.ex +++ b/lib/phone/be.ex @@ -8,5 +8,5 @@ defmodule Phone.BE do def a2, do: "BE" def a3, do: "BEL" - matcher :regex, ["32"] + matcher(:regex, ["32"]) end diff --git a/lib/phone/bg.ex b/lib/phone/bg.ex index 04ce77b..3434d83 100644 --- a/lib/phone/bg.ex +++ b/lib/phone/bg.ex @@ -8,5 +8,5 @@ defmodule Phone.BG do def a2, do: "BG" def a3, do: "BGR" - matcher :regex, ["359"] + matcher(:regex, ["359"]) end diff --git a/lib/phone/bh.ex b/lib/phone/bh.ex index 19100e9..d39c0f8 100644 --- a/lib/phone/bh.ex +++ b/lib/phone/bh.ex @@ -8,5 +8,5 @@ defmodule Phone.BH do def a2, do: "BH" def a3, do: "BHR" - matcher :regex, ["973"] + matcher(:regex, ["973"]) end diff --git a/lib/phone/bi.ex b/lib/phone/bi.ex index 4bd6997..89c0b33 100644 --- a/lib/phone/bi.ex +++ b/lib/phone/bi.ex @@ -8,5 +8,5 @@ defmodule Phone.BI do def a2, do: "BI" def a3, do: "BDI" - matcher :regex, ["257"] + matcher(:regex, ["257"]) end diff --git a/lib/phone/bj.ex b/lib/phone/bj.ex index b6b04ea..12d3b25 100644 --- a/lib/phone/bj.ex +++ b/lib/phone/bj.ex @@ -8,5 +8,5 @@ defmodule Phone.BJ do def a2, do: "BJ" def a3, do: "BEN" - matcher :regex, ["229"] + matcher(:regex, ["229"]) end diff --git a/lib/phone/bn.ex b/lib/phone/bn.ex index a2535b4..e2a0d3a 100644 --- a/lib/phone/bn.ex +++ b/lib/phone/bn.ex @@ -8,5 +8,5 @@ defmodule Phone.BN do def a2, do: "BN" def a3, do: "BRN" - matcher :regex, ["673"] + matcher(:regex, ["673"]) end diff --git a/lib/phone/bo.ex b/lib/phone/bo.ex index 6639fad..c61c3ed 100644 --- a/lib/phone/bo.ex +++ b/lib/phone/bo.ex @@ -8,5 +8,5 @@ defmodule Phone.BO do def a2, do: "BO" def a3, do: "BOL" - matcher :regex, ["591"] + matcher(:regex, ["591"]) end diff --git a/lib/phone/br.ex b/lib/phone/br.ex index f7b7fc0..7e280b6 100644 --- a/lib/phone/br.ex +++ b/lib/phone/br.ex @@ -7,10 +7,33 @@ defmodule Phone.BR do 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] + 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 9a0595e..de60f9c 100644 --- a/lib/phone/br/ac.ex +++ b/lib/phone/br/ac.ex @@ -8,5 +8,5 @@ defmodule Phone.BR.AC do def area_type, do: "state" def area_abbreviation, do: "AC" - matcher ["5568"] + matcher(["5568"]) end diff --git a/lib/phone/br/al.ex b/lib/phone/br/al.ex index acd10ea..8686980 100644 --- a/lib/phone/br/al.ex +++ b/lib/phone/br/al.ex @@ -8,5 +8,5 @@ defmodule Phone.BR.AL do def area_type, do: "state" def area_abbreviation, do: "AL" - matcher ["5582"] + matcher(["5582"]) end diff --git a/lib/phone/br/am.ex b/lib/phone/br/am.ex index e95ed46..afffa3d 100644 --- a/lib/phone/br/am.ex +++ b/lib/phone/br/am.ex @@ -8,5 +8,5 @@ defmodule Phone.BR.AM do def area_type, do: "state" def area_abbreviation, do: "AM" - matcher ["5592", "5597"] + matcher(["5592", "5597"]) end diff --git a/lib/phone/br/ap.ex b/lib/phone/br/ap.ex index f1066dc..b83e654 100644 --- a/lib/phone/br/ap.ex +++ b/lib/phone/br/ap.ex @@ -8,5 +8,5 @@ defmodule Phone.BR.AP do def area_type, do: "state" def area_abbreviation, do: "AP" - matcher ["5596"] + matcher(["5596"]) end diff --git a/lib/phone/br/ba.ex b/lib/phone/br/ba.ex index 2218ac6..6d6ab2a 100644 --- a/lib/phone/br/ba.ex +++ b/lib/phone/br/ba.ex @@ -8,5 +8,5 @@ defmodule Phone.BR.BA do def area_type, do: "state" def area_abbreviation, do: "BA" - matcher ["5571", "5573", "5574", "5575", "5577"] + matcher(["5571", "5573", "5574", "5575", "5577"]) end diff --git a/lib/phone/br/ce.ex b/lib/phone/br/ce.ex index 4edce4a..247b134 100644 --- a/lib/phone/br/ce.ex +++ b/lib/phone/br/ce.ex @@ -8,5 +8,5 @@ defmodule Phone.BR.CE do def area_type, do: "state" def area_abbreviation, do: "CE" - matcher ["5585", "5588"] + matcher(["5585", "5588"]) end diff --git a/lib/phone/br/df.ex b/lib/phone/br/df.ex index 8850889..ac811d0 100644 --- a/lib/phone/br/df.ex +++ b/lib/phone/br/df.ex @@ -8,5 +8,5 @@ defmodule Phone.BR.DF do def area_type, do: "district" def area_abbreviation, do: "DF" - matcher ["5561"] + matcher(["5561"]) end diff --git a/lib/phone/br/es.ex b/lib/phone/br/es.ex index b850d17..4ae6039 100644 --- a/lib/phone/br/es.ex +++ b/lib/phone/br/es.ex @@ -8,5 +8,5 @@ defmodule Phone.BR.ES do def area_type, do: "state" def area_abbreviation, do: "ES" - matcher ["5527", "5528"] + matcher(["5527", "5528"]) end diff --git a/lib/phone/br/go.ex b/lib/phone/br/go.ex index 32655ec..48a692a 100644 --- a/lib/phone/br/go.ex +++ b/lib/phone/br/go.ex @@ -8,5 +8,5 @@ defmodule Phone.BR.GO do def area_type, do: "state" def area_abbreviation, do: "GO" - matcher ["5562", "5564"] + matcher(["5562", "5564"]) end diff --git a/lib/phone/br/ma.ex b/lib/phone/br/ma.ex index f4d7364..4805daa 100644 --- a/lib/phone/br/ma.ex +++ b/lib/phone/br/ma.ex @@ -8,5 +8,5 @@ defmodule Phone.BR.MA do def area_type, do: "state" def area_abbreviation, do: "MA" - matcher ["5598", "5599"] + matcher(["5598", "5599"]) end diff --git a/lib/phone/br/mg.ex b/lib/phone/br/mg.ex index b75b416..b991c41 100644 --- a/lib/phone/br/mg.ex +++ b/lib/phone/br/mg.ex @@ -8,5 +8,5 @@ defmodule Phone.BR.MG do def area_type, do: "state" def area_abbreviation, do: "MG" - matcher ["5531", "5532", "5533", "5534", "5535", "5537", "5538"] + matcher(["5531", "5532", "5533", "5534", "5535", "5537", "5538"]) end diff --git a/lib/phone/br/ms.ex b/lib/phone/br/ms.ex index a2c6198..2869b6c 100644 --- a/lib/phone/br/ms.ex +++ b/lib/phone/br/ms.ex @@ -8,5 +8,5 @@ defmodule Phone.BR.MS do def area_type, do: "state" def area_abbreviation, do: "MS" - matcher ["5567"] + matcher(["5567"]) end diff --git a/lib/phone/br/mt.ex b/lib/phone/br/mt.ex index 07394db..da15ad7 100644 --- a/lib/phone/br/mt.ex +++ b/lib/phone/br/mt.ex @@ -8,5 +8,5 @@ defmodule Phone.BR.MT do def area_type, do: "state" def area_abbreviation, do: "MT" - matcher ["5565", "5566"] + matcher(["5565", "5566"]) end diff --git a/lib/phone/br/pa.ex b/lib/phone/br/pa.ex index dc5758b..ecdd470 100644 --- a/lib/phone/br/pa.ex +++ b/lib/phone/br/pa.ex @@ -8,5 +8,5 @@ defmodule Phone.BR.PA do def area_type, do: "state" def area_abbreviation, do: "PA" - matcher ["5591", "5593", "5594"] + matcher(["5591", "5593", "5594"]) end diff --git a/lib/phone/br/pb.ex b/lib/phone/br/pb.ex index 7cc6dce..51b2e7c 100644 --- a/lib/phone/br/pb.ex +++ b/lib/phone/br/pb.ex @@ -8,5 +8,5 @@ defmodule Phone.BR.PB do def area_type, do: "state" def area_abbreviation, do: "PB" - matcher ["5583"] + matcher(["5583"]) end diff --git a/lib/phone/br/pe.ex b/lib/phone/br/pe.ex index c76bb6b..856fdd2 100644 --- a/lib/phone/br/pe.ex +++ b/lib/phone/br/pe.ex @@ -8,5 +8,5 @@ defmodule Phone.BR.PE do def area_type, do: "state" def area_abbreviation, do: "PE" - matcher ["5581", "5587"] + matcher(["5581", "5587"]) end diff --git a/lib/phone/br/pi.ex b/lib/phone/br/pi.ex index 2c85a75..3a07c0a 100644 --- a/lib/phone/br/pi.ex +++ b/lib/phone/br/pi.ex @@ -8,5 +8,5 @@ defmodule Phone.BR.PI do def area_type, do: "state" def area_abbreviation, do: "PI" - matcher ["5586", "5589"] + matcher(["5586", "5589"]) end diff --git a/lib/phone/br/pr.ex b/lib/phone/br/pr.ex index 4b1e67e..e6830cd 100644 --- a/lib/phone/br/pr.ex +++ b/lib/phone/br/pr.ex @@ -8,5 +8,5 @@ defmodule Phone.BR.PR do def area_type, do: "state" def area_abbreviation, do: "PR" - matcher ["5541", "5546"] + matcher(["5541", "5546"]) end diff --git a/lib/phone/br/rj.ex b/lib/phone/br/rj.ex index 4559200..9d7d113 100644 --- a/lib/phone/br/rj.ex +++ b/lib/phone/br/rj.ex @@ -8,5 +8,5 @@ defmodule Phone.BR.RJ do def area_type, do: "state" def area_abbreviation, do: "RJ" - matcher ["5521", "5522", "5524"] + matcher(["5521", "5522", "5524"]) end diff --git a/lib/phone/br/rn.ex b/lib/phone/br/rn.ex index e322661..9decaa6 100644 --- a/lib/phone/br/rn.ex +++ b/lib/phone/br/rn.ex @@ -8,5 +8,5 @@ defmodule Phone.BR.RN do def area_type, do: "state" def area_abbreviation, do: "RN" - matcher ["5584"] + matcher(["5584"]) end diff --git a/lib/phone/br/ro.ex b/lib/phone/br/ro.ex index dc79b0e..f98f839 100644 --- a/lib/phone/br/ro.ex +++ b/lib/phone/br/ro.ex @@ -8,5 +8,5 @@ defmodule Phone.BR.RO do def area_type, do: "state" def area_abbreviation, do: "RO" - matcher ["5569"] + matcher(["5569"]) end diff --git a/lib/phone/br/rr.ex b/lib/phone/br/rr.ex index f2d88d5..b2403cd 100644 --- a/lib/phone/br/rr.ex +++ b/lib/phone/br/rr.ex @@ -8,5 +8,5 @@ defmodule Phone.BR.RR do def area_type, do: "state" def area_abbreviation, do: "RR" - matcher ["5595"] + matcher(["5595"]) end diff --git a/lib/phone/br/rs.ex b/lib/phone/br/rs.ex index 4c9680e..c27893d 100644 --- a/lib/phone/br/rs.ex +++ b/lib/phone/br/rs.ex @@ -8,5 +8,5 @@ defmodule Phone.BR.RS do def area_type, do: "state" def area_abbreviation, do: "RS" - matcher ["5551", "5553", "5554", "5555"] + matcher(["5551", "5553", "5554", "5555"]) end diff --git a/lib/phone/br/sc.ex b/lib/phone/br/sc.ex index a82c47f..843c1e2 100644 --- a/lib/phone/br/sc.ex +++ b/lib/phone/br/sc.ex @@ -8,5 +8,5 @@ defmodule Phone.BR.SC do def area_type, do: "state" def area_abbreviation, do: "SC" - matcher ["5547", "5548", "5549"] + matcher(["5547", "5548", "5549"]) end diff --git a/lib/phone/br/se.ex b/lib/phone/br/se.ex index 19cd295..cd6573d 100644 --- a/lib/phone/br/se.ex +++ b/lib/phone/br/se.ex @@ -8,5 +8,5 @@ defmodule Phone.BR.SE do def area_type, do: "state" def area_abbreviation, do: "SE" - matcher ["5579"] + matcher(["5579"]) end diff --git a/lib/phone/br/sp.ex b/lib/phone/br/sp.ex index 393d52b..282f81f 100644 --- a/lib/phone/br/sp.ex +++ b/lib/phone/br/sp.ex @@ -8,5 +8,5 @@ defmodule Phone.BR.SP do def area_type, do: "state" def area_abbreviation, do: "SP" - matcher ["5511", "5512", "5513", "5514", "5515", "5516", "5517", "5518", "5519"] + 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 8bb105c..5fdf0ee 100644 --- a/lib/phone/br/to.ex +++ b/lib/phone/br/to.ex @@ -8,5 +8,5 @@ defmodule Phone.BR.TO do def area_type, do: "state" def area_abbreviation, do: "TO" - matcher ["5563"] + matcher(["5563"]) end diff --git a/lib/phone/bt.ex b/lib/phone/bt.ex index 0daa735..1b6375c 100644 --- a/lib/phone/bt.ex +++ b/lib/phone/bt.ex @@ -8,5 +8,5 @@ defmodule Phone.BT do def a2, do: "BT" def a3, do: "BTN" - matcher :regex, ["975"] + matcher(:regex, ["975"]) end diff --git a/lib/phone/bw.ex b/lib/phone/bw.ex index 7dea3ff..708d6a7 100644 --- a/lib/phone/bw.ex +++ b/lib/phone/bw.ex @@ -8,5 +8,5 @@ defmodule Phone.BW do def a2, do: "BW" def a3, do: "BWA" - matcher :regex, ["267"] + matcher(:regex, ["267"]) end diff --git a/lib/phone/by.ex b/lib/phone/by.ex index 8cda3cf..adddde4 100644 --- a/lib/phone/by.ex +++ b/lib/phone/by.ex @@ -8,5 +8,5 @@ defmodule Phone.BY do def a2, do: "BY" def a3, do: "BLR" - matcher :regex, ["375"] + matcher(:regex, ["375"]) end diff --git a/lib/phone/bz.ex b/lib/phone/bz.ex index c56c124..9a74683 100644 --- a/lib/phone/bz.ex +++ b/lib/phone/bz.ex @@ -8,5 +8,5 @@ defmodule Phone.BZ do def a2, do: "BZ" def a3, do: "BLZ" - matcher :regex, ["501"] + matcher(:regex, ["501"]) end diff --git a/lib/phone/cd.ex b/lib/phone/cd.ex index 31b6186..c905e0c 100644 --- a/lib/phone/cd.ex +++ b/lib/phone/cd.ex @@ -8,5 +8,5 @@ defmodule Phone.CD do def a2, do: "CD" def a3, do: "COD" - matcher :regex, ["243"] + matcher(:regex, ["243"]) end diff --git a/lib/phone/cf.ex b/lib/phone/cf.ex index 00500f1..3a50661 100644 --- a/lib/phone/cf.ex +++ b/lib/phone/cf.ex @@ -8,5 +8,5 @@ defmodule Phone.CF do def a2, do: "CF" def a3, do: "CAF" - matcher :regex, ["236"] + matcher(:regex, ["236"]) end diff --git a/lib/phone/cg.ex b/lib/phone/cg.ex index b13dac7..5ff57d3 100644 --- a/lib/phone/cg.ex +++ b/lib/phone/cg.ex @@ -8,5 +8,5 @@ defmodule Phone.CG do def a2, do: "CG" def a3, do: "COG" - matcher :regex, ["242"] + matcher(:regex, ["242"]) end diff --git a/lib/phone/ch.ex b/lib/phone/ch.ex index 9a81fe1..7c1c1b5 100644 --- a/lib/phone/ch.ex +++ b/lib/phone/ch.ex @@ -8,5 +8,5 @@ defmodule Phone.CH do def a2, do: "CH" def a3, do: "CHE" - matcher :regex, ["41"] + matcher(:regex, ["41"]) end diff --git a/lib/phone/ci.ex b/lib/phone/ci.ex index 559113e..f266c42 100644 --- a/lib/phone/ci.ex +++ b/lib/phone/ci.ex @@ -8,5 +8,5 @@ defmodule Phone.CI do def a2, do: "CI" def a3, do: "CIV" - matcher :regex, ["225"] + matcher(:regex, ["225"]) end diff --git a/lib/phone/ck.ex b/lib/phone/ck.ex index 3172aa6..820d975 100644 --- a/lib/phone/ck.ex +++ b/lib/phone/ck.ex @@ -8,5 +8,5 @@ defmodule Phone.CK do def a2, do: "CK" def a3, do: "COK" - matcher :regex, ["682"] + matcher(:regex, ["682"]) end diff --git a/lib/phone/cl.ex b/lib/phone/cl.ex index ce63706..bfe27a4 100644 --- a/lib/phone/cl.ex +++ b/lib/phone/cl.ex @@ -8,5 +8,5 @@ defmodule Phone.CL do def a2, do: "CL" def a3, do: "CHL" - matcher :regex, ["56"] + matcher(:regex, ["56"]) end diff --git a/lib/phone/cm.ex b/lib/phone/cm.ex index e2ba5f0..176c740 100644 --- a/lib/phone/cm.ex +++ b/lib/phone/cm.ex @@ -8,5 +8,5 @@ defmodule Phone.CM do def a2, do: "CM" def a3, do: "CMR" - matcher :regex, ["237"] + matcher(:regex, ["237"]) end diff --git a/lib/phone/cn.ex b/lib/phone/cn.ex index b2d92b2..bb53c08 100644 --- a/lib/phone/cn.ex +++ b/lib/phone/cn.ex @@ -8,5 +8,5 @@ defmodule Phone.CN do def a2, do: "CN" def a3, do: "CHN" - matcher :regex, ["86"] + matcher(:regex, ["86"]) end diff --git a/lib/phone/co.ex b/lib/phone/co.ex index 3054dce..282c05b 100644 --- a/lib/phone/co.ex +++ b/lib/phone/co.ex @@ -8,5 +8,5 @@ defmodule Phone.CO do def a2, do: "CO" def a3, do: "COL" - matcher :regex, ["57"] + matcher(:regex, ["57"]) end diff --git a/lib/phone/countries.ex b/lib/phone/countries.ex index bb78230..29b66b6 100644 --- a/lib/phone/countries.ex +++ b/lib/phone/countries.ex @@ -3,40 +3,206 @@ defmodule Phone.Countries do use Helper.Country - 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, - Phone.BN, Phone.BO, Phone.BR, Phone.BT, Phone.BW, Phone.BY, - Phone.BZ, Phone.CD, Phone.CF, Phone.CG, Phone.CH, Phone.CI, - Phone.CK, Phone.CL, Phone.CM, Phone.CN, Phone.CO, Phone.CR, - Phone.CU, Phone.CV, Phone.CW, Phone.CY, Phone.CZ, Phone.DE, - Phone.DJ, Phone.DK, Phone.DZ, Phone.EC, Phone.EE, Phone.EG, - Phone.ER, Phone.ES, Phone.ET, Phone.FI, Phone.FJ, Phone.FM, - Phone.FO, Phone.FR, Phone.GA, Phone.GB, Phone.GE, Phone.GF, - Phone.GH, Phone.GI, Phone.GL, Phone.GM, Phone.GN, Phone.GQ, - Phone.GR, Phone.GT, Phone.GW, Phone.GY, Phone.HK, Phone.HN, - Phone.HR, Phone.HT, Phone.HU, Phone.ID, Phone.IE, Phone.IL, - Phone.IN, Phone.IO, Phone.IQ, Phone.IR, Phone.IS, Phone.IT, - Phone.JO, Phone.JP, Phone.KE, Phone.KG, Phone.KH, Phone.KI, - Phone.KM, Phone.KP, Phone.KR, Phone.KW, Phone.KZ, Phone.LA, - Phone.LB, Phone.LI, Phone.LK, Phone.LR, Phone.LS, Phone.LT, - Phone.LU, Phone.LV, Phone.LY, Phone.MA, Phone.MC, Phone.MD, - Phone.ME, Phone.MG, Phone.MH, Phone.MK, Phone.ML, Phone.MM, - Phone.MN, Phone.MO, Phone.MQ, Phone.MR, Phone.MT, Phone.MU, - Phone.MV, Phone.MW, Phone.MX, Phone.MY, Phone.MZ, Phone.NA, - Phone.NC, Phone.NE, Phone.NG, Phone.NI, Phone.NL, Phone.NO, - Phone.NP, Phone.NR, Phone.NU, Phone.NZ, Phone.OM, Phone.PA, - Phone.PE, Phone.PF, Phone.PG, Phone.PH, Phone.PK, Phone.PL, - Phone.PM, Phone.PS, Phone.PT, Phone.PW, Phone.PY, Phone.QA, - Phone.RO, Phone.RS, Phone.RU, Phone.RW, Phone.SA, Phone.SB, - Phone.SC, Phone.SD, Phone.SE, Phone.SG, Phone.SH, Phone.SI, - Phone.SK, Phone.SL, Phone.SM, Phone.SN, Phone.SO, Phone.SR, - Phone.SS, Phone.ST, Phone.SV, Phone.SY, Phone.SZ, Phone.TD, - Phone.TG, Phone.TH, Phone.TJ, Phone.TK, Phone.TL, Phone.TM, - Phone.TN, Phone.TO, Phone.TR, Phone.TV, Phone.TW, Phone.TZ, - Phone.UA, Phone.UG, Phone.UY, Phone.UZ, Phone.VE, Phone.VN, - Phone.VU, Phone.WF, Phone.WS, Phone.YE, Phone.ZA, Phone.ZM, - Phone.ZW, Phone.NANP - ] + 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, + Phone.BN, + Phone.BO, + Phone.BR, + Phone.BT, + Phone.BW, + Phone.BY, + Phone.BZ, + Phone.CD, + Phone.CF, + Phone.CG, + Phone.CH, + Phone.CI, + Phone.CK, + Phone.CL, + Phone.CM, + Phone.CN, + Phone.CO, + Phone.CR, + Phone.CU, + Phone.CV, + Phone.CW, + Phone.CY, + Phone.CZ, + Phone.DE, + Phone.DJ, + Phone.DK, + Phone.DZ, + Phone.EC, + Phone.EE, + Phone.EG, + Phone.ER, + Phone.ES, + Phone.ET, + Phone.FI, + Phone.FJ, + Phone.FM, + Phone.FO, + Phone.FR, + Phone.GA, + Phone.GB, + Phone.GE, + Phone.GF, + Phone.GH, + Phone.GI, + Phone.GL, + Phone.GM, + Phone.GN, + Phone.GQ, + Phone.GR, + Phone.GT, + Phone.GW, + Phone.GY, + Phone.HK, + Phone.HN, + Phone.HR, + Phone.HT, + Phone.HU, + Phone.ID, + Phone.IE, + Phone.IL, + Phone.IN, + Phone.IO, + Phone.IQ, + Phone.IR, + Phone.IS, + Phone.IT, + Phone.JO, + Phone.JP, + Phone.KE, + Phone.KG, + Phone.KH, + Phone.KI, + Phone.KM, + Phone.KP, + Phone.KR, + Phone.KW, + Phone.KZ, + Phone.LA, + Phone.LB, + Phone.LI, + Phone.LK, + Phone.LR, + Phone.LS, + Phone.LT, + Phone.LU, + Phone.LV, + Phone.LY, + Phone.MA, + Phone.MC, + Phone.MD, + Phone.ME, + Phone.MG, + Phone.MH, + Phone.MK, + Phone.ML, + Phone.MM, + Phone.MN, + Phone.MO, + Phone.MQ, + Phone.MR, + Phone.MT, + Phone.MU, + Phone.MV, + Phone.MW, + Phone.MX, + Phone.MY, + Phone.MZ, + Phone.NA, + Phone.NC, + Phone.NE, + Phone.NG, + Phone.NI, + Phone.NL, + Phone.NO, + Phone.NP, + Phone.NR, + Phone.NU, + Phone.NZ, + Phone.OM, + Phone.PA, + Phone.PE, + Phone.PF, + Phone.PG, + Phone.PH, + Phone.PK, + Phone.PL, + Phone.PM, + Phone.PS, + Phone.PT, + Phone.PW, + Phone.PY, + Phone.QA, + Phone.RO, + Phone.RS, + Phone.RU, + Phone.RW, + Phone.SA, + Phone.SB, + Phone.SC, + Phone.SD, + Phone.SE, + Phone.SG, + Phone.SH, + Phone.SI, + Phone.SK, + Phone.SL, + Phone.SM, + Phone.SN, + Phone.SO, + Phone.SR, + Phone.SS, + Phone.ST, + Phone.SV, + Phone.SY, + Phone.SZ, + Phone.TD, + Phone.TG, + Phone.TH, + Phone.TJ, + Phone.TK, + Phone.TL, + Phone.TM, + Phone.TN, + Phone.TO, + Phone.TR, + Phone.TV, + Phone.TW, + Phone.TZ, + Phone.UA, + Phone.UG, + Phone.UY, + Phone.UZ, + Phone.VE, + Phone.VN, + Phone.VU, + Phone.WF, + Phone.WS, + Phone.YE, + Phone.ZA, + Phone.ZM, + Phone.ZW, + Phone.NANP + ]) end diff --git a/lib/phone/cr.ex b/lib/phone/cr.ex index 357ba21..738e3ab 100644 --- a/lib/phone/cr.ex +++ b/lib/phone/cr.ex @@ -8,5 +8,5 @@ defmodule Phone.CR do def a2, do: "CR" def a3, do: "CRI" - matcher :regex, ["506"] + matcher(:regex, ["506"]) end diff --git a/lib/phone/cu.ex b/lib/phone/cu.ex index 4b25ac2..e171c42 100644 --- a/lib/phone/cu.ex +++ b/lib/phone/cu.ex @@ -8,5 +8,5 @@ defmodule Phone.CU do def a2, do: "CU" def a3, do: "CUB" - matcher :regex, ["53"] + matcher(:regex, ["53"]) end diff --git a/lib/phone/cv.ex b/lib/phone/cv.ex index fb950f6..448f740 100644 --- a/lib/phone/cv.ex +++ b/lib/phone/cv.ex @@ -8,5 +8,5 @@ defmodule Phone.CV do def a2, do: "CV" def a3, do: "CPV" - matcher :regex, ["238"] + matcher(:regex, ["238"]) end diff --git a/lib/phone/cw.ex b/lib/phone/cw.ex index 40ef809..6fef821 100644 --- a/lib/phone/cw.ex +++ b/lib/phone/cw.ex @@ -8,5 +8,5 @@ defmodule Phone.CW do def a2, do: "CW" def a3, do: "CUW" - matcher :regex, ["5999"] + matcher(:regex, ["5999"]) end diff --git a/lib/phone/cy.ex b/lib/phone/cy.ex index d4f7699..c57c20d 100644 --- a/lib/phone/cy.ex +++ b/lib/phone/cy.ex @@ -8,5 +8,5 @@ defmodule Phone.CY do def a2, do: "CY" def a3, do: "CYP" - matcher :regex, ["357"] + matcher(:regex, ["357"]) end diff --git a/lib/phone/cz.ex b/lib/phone/cz.ex index c4cdac0..555a2e2 100644 --- a/lib/phone/cz.ex +++ b/lib/phone/cz.ex @@ -8,5 +8,5 @@ defmodule Phone.CZ do def a2, do: "CZ" def a3, do: "CZE" - matcher :regex, ["420"] + matcher(:regex, ["420"]) end diff --git a/lib/phone/de.ex b/lib/phone/de.ex index e2269bf..d6f5875 100644 --- a/lib/phone/de.ex +++ b/lib/phone/de.ex @@ -8,5 +8,5 @@ defmodule Phone.DE do def a2, do: "DE" def a3, do: "DEU" - matcher :regex, ["49"] + matcher(:regex, ["49"]) end diff --git a/lib/phone/dj.ex b/lib/phone/dj.ex index 99cd942..146de48 100644 --- a/lib/phone/dj.ex +++ b/lib/phone/dj.ex @@ -8,5 +8,5 @@ defmodule Phone.DJ do def a2, do: "DJ" def a3, do: "DJI" - matcher :regex, ["253"] + matcher(:regex, ["253"]) end diff --git a/lib/phone/dk.ex b/lib/phone/dk.ex index 1802b61..2c1f40c 100644 --- a/lib/phone/dk.ex +++ b/lib/phone/dk.ex @@ -8,5 +8,5 @@ defmodule Phone.DK do def a2, do: "DK" def a3, do: "DNK" - matcher :regex, ["45"] + matcher(:regex, ["45"]) end diff --git a/lib/phone/dz.ex b/lib/phone/dz.ex index 1bccc67..b1fd537 100644 --- a/lib/phone/dz.ex +++ b/lib/phone/dz.ex @@ -8,5 +8,5 @@ defmodule Phone.DZ do def a2, do: "DZ" def a3, do: "DZA" - matcher :regex, ["213"] + matcher(:regex, ["213"]) end diff --git a/lib/phone/ec.ex b/lib/phone/ec.ex index 33df959..a451937 100644 --- a/lib/phone/ec.ex +++ b/lib/phone/ec.ex @@ -8,5 +8,5 @@ defmodule Phone.EC do def a2, do: "EC" def a3, do: "ECU" - matcher :regex, ["593"] + matcher(:regex, ["593"]) end diff --git a/lib/phone/ee.ex b/lib/phone/ee.ex index 77900a8..1e2a345 100644 --- a/lib/phone/ee.ex +++ b/lib/phone/ee.ex @@ -8,5 +8,5 @@ defmodule Phone.EE do def a2, do: "EE" def a3, do: "EST" - matcher :regex, ["372"] + matcher(:regex, ["372"]) end diff --git a/lib/phone/eg.ex b/lib/phone/eg.ex index 6230fc0..ca249b0 100644 --- a/lib/phone/eg.ex +++ b/lib/phone/eg.ex @@ -8,5 +8,5 @@ defmodule Phone.EG do def a2, do: "EG" def a3, do: "EGY" - matcher :regex, ["20"] + matcher(:regex, ["20"]) end diff --git a/lib/phone/er.ex b/lib/phone/er.ex index fe16552..925f554 100644 --- a/lib/phone/er.ex +++ b/lib/phone/er.ex @@ -8,5 +8,5 @@ defmodule Phone.ER do def a2, do: "ER" def a3, do: "ERI" - matcher :regex, ["291"] + matcher(:regex, ["291"]) end diff --git a/lib/phone/es.ex b/lib/phone/es.ex index b759690..cc5afda 100644 --- a/lib/phone/es.ex +++ b/lib/phone/es.ex @@ -8,5 +8,5 @@ defmodule Phone.ES do def a2, do: "ES" def a3, do: "ESP" - matcher :regex, ["34"] + matcher(:regex, ["34"]) end diff --git a/lib/phone/et.ex b/lib/phone/et.ex index 712ff85..67484c8 100644 --- a/lib/phone/et.ex +++ b/lib/phone/et.ex @@ -8,5 +8,5 @@ defmodule Phone.ET do def a2, do: "ET" def a3, do: "ETH" - matcher :regex, ["251"] + matcher(:regex, ["251"]) end diff --git a/lib/phone/fi.ex b/lib/phone/fi.ex index cd7caeb..ea4bbba 100644 --- a/lib/phone/fi.ex +++ b/lib/phone/fi.ex @@ -8,5 +8,5 @@ defmodule Phone.FI do def a2, do: "FI" def a3, do: "FIN" - matcher :regex, ["358"] + matcher(:regex, ["358"]) end diff --git a/lib/phone/fj.ex b/lib/phone/fj.ex index 0d7b84d..5044b3b 100644 --- a/lib/phone/fj.ex +++ b/lib/phone/fj.ex @@ -8,5 +8,5 @@ defmodule Phone.FJ do def a2, do: "FJ" def a3, do: "FJI" - matcher :regex, ["679"] + matcher(:regex, ["679"]) end diff --git a/lib/phone/fm.ex b/lib/phone/fm.ex index 0b994d5..2b93057 100644 --- a/lib/phone/fm.ex +++ b/lib/phone/fm.ex @@ -8,5 +8,5 @@ defmodule Phone.FM do def a2, do: "FM" def a3, do: "FSM" - matcher :regex, ["691"] + matcher(:regex, ["691"]) end diff --git a/lib/phone/fo.ex b/lib/phone/fo.ex index c96b752..5285a1e 100644 --- a/lib/phone/fo.ex +++ b/lib/phone/fo.ex @@ -8,5 +8,5 @@ defmodule Phone.FO do def a2, do: "FO" def a3, do: "FRO" - matcher :regex, ["298"] + matcher(:regex, ["298"]) end diff --git a/lib/phone/fr.ex b/lib/phone/fr.ex index 4bf1458..a05df13 100644 --- a/lib/phone/fr.ex +++ b/lib/phone/fr.ex @@ -8,5 +8,5 @@ defmodule Phone.FR do def a2, do: "FR" def a3, do: "FRA" - matcher :regex, ["33"] + matcher(:regex, ["33"]) end diff --git a/lib/phone/ga.ex b/lib/phone/ga.ex index 1f6b7ba..2798ded 100644 --- a/lib/phone/ga.ex +++ b/lib/phone/ga.ex @@ -8,5 +8,5 @@ defmodule Phone.GA do def a2, do: "GA" def a3, do: "GAB" - matcher :regex, ["241"] + matcher(:regex, ["241"]) end diff --git a/lib/phone/gb.ex b/lib/phone/gb.ex index 182c45b..daa9f69 100644 --- a/lib/phone/gb.ex +++ b/lib/phone/gb.ex @@ -8,5 +8,5 @@ defmodule Phone.GB do def a2, do: "GB" def a3, do: "GBR" - matcher :regex, ["44"] + matcher(:regex, ["44"]) end diff --git a/lib/phone/ge.ex b/lib/phone/ge.ex index 25ccfc1..ee5204f 100644 --- a/lib/phone/ge.ex +++ b/lib/phone/ge.ex @@ -8,5 +8,5 @@ defmodule Phone.GE do def a2, do: "GE" def a3, do: "GEO" - matcher :regex, ["995"] + matcher(:regex, ["995"]) end diff --git a/lib/phone/gf.ex b/lib/phone/gf.ex index cfdcdae..9699831 100644 --- a/lib/phone/gf.ex +++ b/lib/phone/gf.ex @@ -8,5 +8,5 @@ defmodule Phone.GF do def a2, do: "GF" def a3, do: "GUF" - matcher :regex, ["594594", "594694"] + matcher(:regex, ["594594", "594694"]) end diff --git a/lib/phone/gh.ex b/lib/phone/gh.ex index d082c6b..7612ee3 100644 --- a/lib/phone/gh.ex +++ b/lib/phone/gh.ex @@ -8,5 +8,5 @@ defmodule Phone.GH do def a2, do: "GH" def a3, do: "GHA" - matcher :regex, ["233"] + matcher(:regex, ["233"]) end diff --git a/lib/phone/gi.ex b/lib/phone/gi.ex index 7ac51c1..92dc110 100644 --- a/lib/phone/gi.ex +++ b/lib/phone/gi.ex @@ -8,5 +8,5 @@ defmodule Phone.GI do def a2, do: "GI" def a3, do: "GIB" - matcher :regex, ["350"] + matcher(:regex, ["350"]) end diff --git a/lib/phone/gl.ex b/lib/phone/gl.ex index f743d5e..7ee17b4 100644 --- a/lib/phone/gl.ex +++ b/lib/phone/gl.ex @@ -8,5 +8,5 @@ defmodule Phone.GL do def a2, do: "GL" def a3, do: "GRL" - matcher :regex, ["299"] + matcher(:regex, ["299"]) end diff --git a/lib/phone/gm.ex b/lib/phone/gm.ex index 485af81..f849413 100644 --- a/lib/phone/gm.ex +++ b/lib/phone/gm.ex @@ -8,5 +8,5 @@ defmodule Phone.GM do def a2, do: "GM" def a3, do: "GMB" - matcher :regex, ["220"] + matcher(:regex, ["220"]) end diff --git a/lib/phone/gn.ex b/lib/phone/gn.ex index e8646f0..b16f27f 100644 --- a/lib/phone/gn.ex +++ b/lib/phone/gn.ex @@ -8,5 +8,5 @@ defmodule Phone.GN do def a2, do: "GN" def a3, do: "GIN" - matcher :regex, ["224"] + matcher(:regex, ["224"]) end diff --git a/lib/phone/gq.ex b/lib/phone/gq.ex index 1f8552b..e62531d 100644 --- a/lib/phone/gq.ex +++ b/lib/phone/gq.ex @@ -8,5 +8,5 @@ defmodule Phone.GQ do def a2, do: "GQ" def a3, do: "GNQ" - matcher :regex, ["240"] + matcher(:regex, ["240"]) end diff --git a/lib/phone/gr.ex b/lib/phone/gr.ex index 7d1f03f..9fb637e 100644 --- a/lib/phone/gr.ex +++ b/lib/phone/gr.ex @@ -8,5 +8,5 @@ defmodule Phone.GR do def a2, do: "GR" def a3, do: "GRC" - matcher :regex, ["30"] + matcher(:regex, ["30"]) end diff --git a/lib/phone/gt.ex b/lib/phone/gt.ex index 8d42119..e3aa4ba 100644 --- a/lib/phone/gt.ex +++ b/lib/phone/gt.ex @@ -8,5 +8,5 @@ defmodule Phone.GT do def a2, do: "GT" def a3, do: "GTM" - matcher :regex, ["502"] + matcher(:regex, ["502"]) end diff --git a/lib/phone/gw.ex b/lib/phone/gw.ex index 3f4d2df..0dd3c43 100644 --- a/lib/phone/gw.ex +++ b/lib/phone/gw.ex @@ -8,5 +8,5 @@ defmodule Phone.GW do def a2, do: "GW" def a3, do: "GNB" - matcher :regex, ["245"] + matcher(:regex, ["245"]) end diff --git a/lib/phone/gy.ex b/lib/phone/gy.ex index 93ef366..c7dcc1b 100644 --- a/lib/phone/gy.ex +++ b/lib/phone/gy.ex @@ -8,5 +8,5 @@ defmodule Phone.GY do def a2, do: "GY" def a3, do: "GUY" - matcher :regex, ["592"] + matcher(:regex, ["592"]) end diff --git a/lib/phone/hk.ex b/lib/phone/hk.ex index 22ca50f..903d26b 100644 --- a/lib/phone/hk.ex +++ b/lib/phone/hk.ex @@ -8,5 +8,5 @@ defmodule Phone.HK do def a2, do: "HK" def a3, do: "HKG" - matcher :regex, ["852"] + matcher(:regex, ["852"]) end diff --git a/lib/phone/hn.ex b/lib/phone/hn.ex index 0e09b88..cc1a98f 100644 --- a/lib/phone/hn.ex +++ b/lib/phone/hn.ex @@ -8,5 +8,5 @@ defmodule Phone.HN do def a2, do: "HN" def a3, do: "HND" - matcher :regex, ["504"] + matcher(:regex, ["504"]) end diff --git a/lib/phone/hr.ex b/lib/phone/hr.ex index 2a489f3..d714788 100644 --- a/lib/phone/hr.ex +++ b/lib/phone/hr.ex @@ -8,5 +8,5 @@ defmodule Phone.HR do def a2, do: "HR" def a3, do: "HRV" - matcher :regex, ["385"] + matcher(:regex, ["385"]) end diff --git a/lib/phone/ht.ex b/lib/phone/ht.ex index 784dec3..3b84e41 100644 --- a/lib/phone/ht.ex +++ b/lib/phone/ht.ex @@ -8,5 +8,5 @@ defmodule Phone.HT do def a2, do: "HT" def a3, do: "HTI" - matcher :regex, ["509"] + matcher(:regex, ["509"]) end diff --git a/lib/phone/hu.ex b/lib/phone/hu.ex index ab3d6d7..42f2c7a 100644 --- a/lib/phone/hu.ex +++ b/lib/phone/hu.ex @@ -8,5 +8,5 @@ defmodule Phone.HU do def a2, do: "HU" def a3, do: "HUN" - matcher :regex, ["36"] + matcher(:regex, ["36"]) end diff --git a/lib/phone/id.ex b/lib/phone/id.ex index 25e8c10..459ae32 100644 --- a/lib/phone/id.ex +++ b/lib/phone/id.ex @@ -8,5 +8,5 @@ defmodule Phone.ID do def a2, do: "ID" def a3, do: "IDN" - matcher :regex, ["62"] + matcher(:regex, ["62"]) end diff --git a/lib/phone/ie.ex b/lib/phone/ie.ex index 2adbf35..4d2c487 100644 --- a/lib/phone/ie.ex +++ b/lib/phone/ie.ex @@ -8,5 +8,5 @@ defmodule Phone.IE do def a2, do: "IE" def a3, do: "IRL" - matcher :regex, ["353"] + matcher(:regex, ["353"]) end diff --git a/lib/phone/il.ex b/lib/phone/il.ex index 03282ae..4d47e7b 100644 --- a/lib/phone/il.ex +++ b/lib/phone/il.ex @@ -8,5 +8,5 @@ defmodule Phone.IL do def a2, do: "IL" def a3, do: "ISR" - matcher :regex, ["972"] + matcher(:regex, ["972"]) end diff --git a/lib/phone/in.ex b/lib/phone/in.ex index 5308939..7b2032c 100644 --- a/lib/phone/in.ex +++ b/lib/phone/in.ex @@ -8,5 +8,5 @@ defmodule Phone.IN do def a2, do: "IN" def a3, do: "IND" - matcher :regex, ["91"] + matcher(:regex, ["91"]) end diff --git a/lib/phone/io.ex b/lib/phone/io.ex index d39565b..8e7696f 100644 --- a/lib/phone/io.ex +++ b/lib/phone/io.ex @@ -8,5 +8,5 @@ defmodule Phone.IO do def a2, do: "IO" def a3, do: "IOT" - matcher :regex, ["246"] + matcher(:regex, ["246"]) end diff --git a/lib/phone/iq.ex b/lib/phone/iq.ex index 28e4f25..202c6dd 100644 --- a/lib/phone/iq.ex +++ b/lib/phone/iq.ex @@ -8,5 +8,5 @@ defmodule Phone.IQ do def a2, do: "IQ" def a3, do: "IRQ" - matcher :regex, ["964"] + matcher(:regex, ["964"]) end diff --git a/lib/phone/ir.ex b/lib/phone/ir.ex index 8a9eb5c..1e523d5 100644 --- a/lib/phone/ir.ex +++ b/lib/phone/ir.ex @@ -8,5 +8,5 @@ defmodule Phone.IR do def a2, do: "IR" def a3, do: "IRN" - matcher :regex, ["98"] + matcher(:regex, ["98"]) end diff --git a/lib/phone/is.ex b/lib/phone/is.ex index 306060c..7aecbf5 100644 --- a/lib/phone/is.ex +++ b/lib/phone/is.ex @@ -8,5 +8,5 @@ defmodule Phone.IS do def a2, do: "IS" def a3, do: "ISL" - matcher :regex, ["354"] + matcher(:regex, ["354"]) end diff --git a/lib/phone/it.ex b/lib/phone/it.ex index 5656d38..6e2b0c5 100644 --- a/lib/phone/it.ex +++ b/lib/phone/it.ex @@ -8,5 +8,5 @@ defmodule Phone.IT do def a2, do: "IT" def a3, do: "ITA" - matcher :regex, ["39"] + matcher(:regex, ["39"]) end diff --git a/lib/phone/jo.ex b/lib/phone/jo.ex index b856f68..19137e6 100644 --- a/lib/phone/jo.ex +++ b/lib/phone/jo.ex @@ -8,5 +8,5 @@ defmodule Phone.JO do def a2, do: "JO" def a3, do: "JOR" - matcher :regex, ["962"] + matcher(:regex, ["962"]) end diff --git a/lib/phone/jp.ex b/lib/phone/jp.ex index 37869db..bce7c34 100644 --- a/lib/phone/jp.ex +++ b/lib/phone/jp.ex @@ -8,5 +8,5 @@ defmodule Phone.JP do def a2, do: "JP" def a3, do: "JPN" - matcher :regex, ["81"] + matcher(:regex, ["81"]) end diff --git a/lib/phone/ke.ex b/lib/phone/ke.ex index 232425b..471d555 100644 --- a/lib/phone/ke.ex +++ b/lib/phone/ke.ex @@ -8,5 +8,5 @@ defmodule Phone.KE do def a2, do: "KE" def a3, do: "KEN" - matcher :regex, ["254"] + matcher(:regex, ["254"]) end diff --git a/lib/phone/kg.ex b/lib/phone/kg.ex index 40984fd..2e61637 100644 --- a/lib/phone/kg.ex +++ b/lib/phone/kg.ex @@ -8,5 +8,5 @@ defmodule Phone.KG do def a2, do: "KG" def a3, do: "KGZ" - matcher :regex, ["996"] + matcher(:regex, ["996"]) end diff --git a/lib/phone/kh.ex b/lib/phone/kh.ex index 37db936..cd48ab3 100644 --- a/lib/phone/kh.ex +++ b/lib/phone/kh.ex @@ -8,5 +8,5 @@ defmodule Phone.KH do def a2, do: "KH" def a3, do: "KHM" - matcher :regex, ["855"] + matcher(:regex, ["855"]) end diff --git a/lib/phone/ki.ex b/lib/phone/ki.ex index 8fb82ee..fb453e1 100644 --- a/lib/phone/ki.ex +++ b/lib/phone/ki.ex @@ -8,5 +8,5 @@ defmodule Phone.KI do def a2, do: "KI" def a3, do: "KIR" - matcher :regex, ["686"] + matcher(:regex, ["686"]) end diff --git a/lib/phone/km.ex b/lib/phone/km.ex index 45ed251..07ba954 100644 --- a/lib/phone/km.ex +++ b/lib/phone/km.ex @@ -8,5 +8,5 @@ defmodule Phone.KM do def a2, do: "KM" def a3, do: "COM" - matcher :regex, ["269"] + matcher(:regex, ["269"]) end diff --git a/lib/phone/kp.ex b/lib/phone/kp.ex index a66096f..b845e18 100644 --- a/lib/phone/kp.ex +++ b/lib/phone/kp.ex @@ -8,5 +8,5 @@ defmodule Phone.KP do def a2, do: "KP" def a3, do: "PRK" - matcher :regex, ["850"] + matcher(:regex, ["850"]) end diff --git a/lib/phone/kr.ex b/lib/phone/kr.ex index 5c430e0..b98b962 100644 --- a/lib/phone/kr.ex +++ b/lib/phone/kr.ex @@ -8,5 +8,5 @@ defmodule Phone.KR do def a2, do: "KR" def a3, do: "KOR" - matcher :regex, ["82"] + matcher(:regex, ["82"]) end diff --git a/lib/phone/kw.ex b/lib/phone/kw.ex index 7b924b9..851fa79 100644 --- a/lib/phone/kw.ex +++ b/lib/phone/kw.ex @@ -8,5 +8,5 @@ defmodule Phone.KW do def a2, do: "KW" def a3, do: "KWT" - matcher :regex, ["965"] + matcher(:regex, ["965"]) end diff --git a/lib/phone/kz.ex b/lib/phone/kz.ex index 3622c20..4cb567f 100644 --- a/lib/phone/kz.ex +++ b/lib/phone/kz.ex @@ -8,5 +8,5 @@ defmodule Phone.KZ do def a2, do: "KZ" def a3, do: "KAZ" - matcher :regex, ["76", "77"] + matcher(:regex, ["76", "77"]) end diff --git a/lib/phone/la.ex b/lib/phone/la.ex index 6232670..c6947ee 100644 --- a/lib/phone/la.ex +++ b/lib/phone/la.ex @@ -8,5 +8,5 @@ defmodule Phone.LA do def a2, do: "LA" def a3, do: "LAO" - matcher :regex, ["856"] + matcher(:regex, ["856"]) end diff --git a/lib/phone/lb.ex b/lib/phone/lb.ex index a8a3072..58efa65 100644 --- a/lib/phone/lb.ex +++ b/lib/phone/lb.ex @@ -8,5 +8,5 @@ defmodule Phone.LB do def a2, do: "LB" def a3, do: "LBN" - matcher :regex, ["961"] + matcher(:regex, ["961"]) end diff --git a/lib/phone/li.ex b/lib/phone/li.ex index 389a6a2..32e42f5 100644 --- a/lib/phone/li.ex +++ b/lib/phone/li.ex @@ -8,5 +8,5 @@ defmodule Phone.LI do def a2, do: "LI" def a3, do: "LIE" - matcher :regex, ["423"] + matcher(:regex, ["423"]) end diff --git a/lib/phone/lk.ex b/lib/phone/lk.ex index f436df8..ea8fcd6 100644 --- a/lib/phone/lk.ex +++ b/lib/phone/lk.ex @@ -8,5 +8,5 @@ defmodule Phone.LK do def a2, do: "LK" def a3, do: "LKA" - matcher :regex, ["94"] + matcher(:regex, ["94"]) end diff --git a/lib/phone/lr.ex b/lib/phone/lr.ex index f78bfb3..eded580 100644 --- a/lib/phone/lr.ex +++ b/lib/phone/lr.ex @@ -8,5 +8,5 @@ defmodule Phone.LR do def a2, do: "LR" def a3, do: "LBR" - matcher :regex, ["231"] + matcher(:regex, ["231"]) end diff --git a/lib/phone/ls.ex b/lib/phone/ls.ex index aaf9536..7b3b9ae 100644 --- a/lib/phone/ls.ex +++ b/lib/phone/ls.ex @@ -8,5 +8,5 @@ defmodule Phone.LS do def a2, do: "LS" def a3, do: "LSO" - matcher :regex, ["266"] + matcher(:regex, ["266"]) end diff --git a/lib/phone/lt.ex b/lib/phone/lt.ex index ff8819e..bcf1aa9 100644 --- a/lib/phone/lt.ex +++ b/lib/phone/lt.ex @@ -8,5 +8,5 @@ defmodule Phone.LT do def a2, do: "LT" def a3, do: "LTU" - matcher :regex, ["370"] + matcher(:regex, ["370"]) end diff --git a/lib/phone/lu.ex b/lib/phone/lu.ex index 5679a5d..03087d9 100644 --- a/lib/phone/lu.ex +++ b/lib/phone/lu.ex @@ -8,5 +8,5 @@ defmodule Phone.LU do def a2, do: "LU" def a3, do: "LUX" - matcher :regex, ["352"] + matcher(:regex, ["352"]) end diff --git a/lib/phone/lv.ex b/lib/phone/lv.ex index 6ce4fc8..e698617 100644 --- a/lib/phone/lv.ex +++ b/lib/phone/lv.ex @@ -8,5 +8,5 @@ defmodule Phone.LV do def a2, do: "LV" def a3, do: "LVA" - matcher :regex, ["371"] + matcher(:regex, ["371"]) end diff --git a/lib/phone/ly.ex b/lib/phone/ly.ex index 22666c7..4c370ec 100644 --- a/lib/phone/ly.ex +++ b/lib/phone/ly.ex @@ -8,5 +8,5 @@ defmodule Phone.LY do def a2, do: "LY" def a3, do: "LBY" - matcher :regex, ["218"] + matcher(:regex, ["218"]) end diff --git a/lib/phone/ma.ex b/lib/phone/ma.ex index 151c363..5fb797f 100644 --- a/lib/phone/ma.ex +++ b/lib/phone/ma.ex @@ -8,5 +8,5 @@ defmodule Phone.MA do def a2, do: "MA" def a3, do: "MAR" - matcher :regex, ["212"] + matcher(:regex, ["212"]) end diff --git a/lib/phone/mc.ex b/lib/phone/mc.ex index 44e2357..8941c31 100644 --- a/lib/phone/mc.ex +++ b/lib/phone/mc.ex @@ -8,5 +8,5 @@ defmodule Phone.MC do def a2, do: "MC" def a3, do: "MCO" - matcher :regex, ["377"] + matcher(:regex, ["377"]) end diff --git a/lib/phone/md.ex b/lib/phone/md.ex index fab4ceb..f3f963b 100644 --- a/lib/phone/md.ex +++ b/lib/phone/md.ex @@ -8,5 +8,5 @@ defmodule Phone.MD do def a2, do: "MD" def a3, do: "MDA" - matcher :regex, ["373"] + matcher(:regex, ["373"]) end diff --git a/lib/phone/me.ex b/lib/phone/me.ex index 1fe667d..1692247 100644 --- a/lib/phone/me.ex +++ b/lib/phone/me.ex @@ -8,5 +8,5 @@ defmodule Phone.ME do def a2, do: "ME" def a3, do: "MNE" - matcher :regex, ["382"] + matcher(:regex, ["382"]) end diff --git a/lib/phone/mg.ex b/lib/phone/mg.ex index 05c9153..6e790a3 100644 --- a/lib/phone/mg.ex +++ b/lib/phone/mg.ex @@ -8,5 +8,5 @@ defmodule Phone.MG do def a2, do: "MG" def a3, do: "MDG" - matcher :regex, ["261"] + matcher(:regex, ["261"]) end diff --git a/lib/phone/mh.ex b/lib/phone/mh.ex index 79c88bd..b561cdb 100644 --- a/lib/phone/mh.ex +++ b/lib/phone/mh.ex @@ -8,5 +8,5 @@ defmodule Phone.MH do def a2, do: "MH" def a3, do: "MHL" - matcher :regex, ["692"] + matcher(:regex, ["692"]) end diff --git a/lib/phone/mk.ex b/lib/phone/mk.ex index cb2f4c3..d24a288 100644 --- a/lib/phone/mk.ex +++ b/lib/phone/mk.ex @@ -8,5 +8,5 @@ defmodule Phone.MK do def a2, do: "MK" def a3, do: "MKD" - matcher :regex, ["389"] + matcher(:regex, ["389"]) end diff --git a/lib/phone/ml.ex b/lib/phone/ml.ex index 18a154a..5a071ba 100644 --- a/lib/phone/ml.ex +++ b/lib/phone/ml.ex @@ -8,5 +8,5 @@ defmodule Phone.ML do def a2, do: "ML" def a3, do: "MLI" - matcher :regex, ["223"] + matcher(:regex, ["223"]) end diff --git a/lib/phone/mm.ex b/lib/phone/mm.ex index 8b9d47a..879eb91 100644 --- a/lib/phone/mm.ex +++ b/lib/phone/mm.ex @@ -8,5 +8,5 @@ defmodule Phone.MM do def a2, do: "MM" def a3, do: "MMR" - matcher :regex, ["95"] + matcher(:regex, ["95"]) end diff --git a/lib/phone/mn.ex b/lib/phone/mn.ex index 0eda821..3e982c5 100644 --- a/lib/phone/mn.ex +++ b/lib/phone/mn.ex @@ -8,5 +8,5 @@ defmodule Phone.MN do def a2, do: "MN" def a3, do: "MNG" - matcher :regex, ["976"] + matcher(:regex, ["976"]) end diff --git a/lib/phone/mo.ex b/lib/phone/mo.ex index 39e5a29..5b52414 100644 --- a/lib/phone/mo.ex +++ b/lib/phone/mo.ex @@ -8,5 +8,5 @@ defmodule Phone.MO do def a2, do: "MO" def a3, do: "MAC" - matcher :regex, ["853"] + matcher(:regex, ["853"]) end diff --git a/lib/phone/mq.ex b/lib/phone/mq.ex index cddd733..c9dda02 100644 --- a/lib/phone/mq.ex +++ b/lib/phone/mq.ex @@ -8,5 +8,5 @@ defmodule Phone.MQ do def a2, do: "MQ" def a3, do: "MTQ" - matcher :regex, ["596596", "596696"] + matcher(:regex, ["596596", "596696"]) end diff --git a/lib/phone/mr.ex b/lib/phone/mr.ex index 75e45bf..12a5005 100644 --- a/lib/phone/mr.ex +++ b/lib/phone/mr.ex @@ -8,5 +8,5 @@ defmodule Phone.MR do def a2, do: "MR" def a3, do: "MRT" - matcher :regex, ["222"] + matcher(:regex, ["222"]) end diff --git a/lib/phone/mt.ex b/lib/phone/mt.ex index 0a43df2..3c74eac 100644 --- a/lib/phone/mt.ex +++ b/lib/phone/mt.ex @@ -8,5 +8,5 @@ defmodule Phone.MT do def a2, do: "MT" def a3, do: "MLT" - matcher :regex, ["356"] + matcher(:regex, ["356"]) end diff --git a/lib/phone/mu.ex b/lib/phone/mu.ex index 9140b41..2daae50 100644 --- a/lib/phone/mu.ex +++ b/lib/phone/mu.ex @@ -8,5 +8,5 @@ defmodule Phone.MU do def a2, do: "MU" def a3, do: "MUS" - matcher :regex, ["230"] + matcher(:regex, ["230"]) end diff --git a/lib/phone/mv.ex b/lib/phone/mv.ex index 13f41ff..6b6cff9 100644 --- a/lib/phone/mv.ex +++ b/lib/phone/mv.ex @@ -8,5 +8,5 @@ defmodule Phone.MV do def a2, do: "MV" def a3, do: "MDV" - matcher :regex, ["960"] + matcher(:regex, ["960"]) end diff --git a/lib/phone/mw.ex b/lib/phone/mw.ex index 19d2edf..f616818 100644 --- a/lib/phone/mw.ex +++ b/lib/phone/mw.ex @@ -8,5 +8,5 @@ defmodule Phone.MW do def a2, do: "MW" def a3, do: "MWI" - matcher :regex, ["265"] + matcher(:regex, ["265"]) end diff --git a/lib/phone/mx.ex b/lib/phone/mx.ex index 3dc3926..4c1ebf4 100644 --- a/lib/phone/mx.ex +++ b/lib/phone/mx.ex @@ -8,5 +8,5 @@ defmodule Phone.MX do def a2, do: "MX" def a3, do: "MEX" - matcher :regex, ["52"] + matcher(:regex, ["52"]) end diff --git a/lib/phone/my.ex b/lib/phone/my.ex index 0438bf8..1db2344 100644 --- a/lib/phone/my.ex +++ b/lib/phone/my.ex @@ -8,5 +8,5 @@ defmodule Phone.MY do def a2, do: "MY" def a3, do: "MYS" - matcher :regex, ["60"] + matcher(:regex, ["60"]) end diff --git a/lib/phone/mz.ex b/lib/phone/mz.ex index b724d36..555aa9a 100644 --- a/lib/phone/mz.ex +++ b/lib/phone/mz.ex @@ -8,5 +8,5 @@ defmodule Phone.MZ do def a2, do: "MZ" def a3, do: "MOZ" - matcher :regex, ["258"] + matcher(:regex, ["258"]) end diff --git a/lib/phone/na.ex b/lib/phone/na.ex index fd0a796..4fa696a 100644 --- a/lib/phone/na.ex +++ b/lib/phone/na.ex @@ -8,5 +8,5 @@ defmodule Phone.NA do def a2, do: "NA" def a3, do: "NAM" - matcher :regex, ["264"] + matcher(:regex, ["264"]) end diff --git a/lib/phone/nanp.ex b/lib/phone/nanp.ex index b10f116..69c987b 100644 --- a/lib/phone/nanp.ex +++ b/lib/phone/nanp.ex @@ -3,11 +3,32 @@ defmodule Phone.NANP do use Helper.Country - 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] + 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 4b8049b..0c737e0 100644 --- a/lib/phone/nanp/ag.ex +++ b/lib/phone/nanp/ag.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.AG do def a2, do: "AG" def a3, do: "ATG" - matcher :regex, ["1268"] + matcher(:regex, ["1268"]) end diff --git a/lib/phone/nanp/ai.ex b/lib/phone/nanp/ai.ex index 323bd28..50d8845 100644 --- a/lib/phone/nanp/ai.ex +++ b/lib/phone/nanp/ai.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.AI do def a2, do: "AI" def a3, do: "AIA" - matcher :regex, ["1264"] + matcher(:regex, ["1264"]) end diff --git a/lib/phone/nanp/as.ex b/lib/phone/nanp/as.ex index e704ba0..43bbf22 100644 --- a/lib/phone/nanp/as.ex +++ b/lib/phone/nanp/as.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.AS do def a2, do: "AS" def a3, do: "ASM" - matcher :regex, ["1684"] + matcher(:regex, ["1684"]) end diff --git a/lib/phone/nanp/bb.ex b/lib/phone/nanp/bb.ex index 2fd365b..66764a3 100644 --- a/lib/phone/nanp/bb.ex +++ b/lib/phone/nanp/bb.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.BB do def a2, do: "BB" def a3, do: "BRB" - matcher :regex, ["1246"] + matcher(:regex, ["1246"]) end diff --git a/lib/phone/nanp/bm.ex b/lib/phone/nanp/bm.ex index 44e072b..8450f07 100644 --- a/lib/phone/nanp/bm.ex +++ b/lib/phone/nanp/bm.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.BM do def a2, do: "BM" def a3, do: "BMU" - matcher :regex, ["1441"] + matcher(:regex, ["1441"]) end diff --git a/lib/phone/nanp/bs.ex b/lib/phone/nanp/bs.ex index e222af1..263cfcf 100644 --- a/lib/phone/nanp/bs.ex +++ b/lib/phone/nanp/bs.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.BS do def a2, do: "BS" def a3, do: "BHS" - matcher :regex, ["1242"] + matcher(:regex, ["1242"]) end diff --git a/lib/phone/nanp/ca.ex b/lib/phone/nanp/ca.ex index 1d6bc5f..e57fe79 100644 --- a/lib/phone/nanp/ca.ex +++ b/lib/phone/nanp/ca.ex @@ -7,8 +7,16 @@ defmodule Phone.NANP.CA do 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.NSAndPE, - Phone.NANP.CA.ON, Phone.NANP.CA.QC, Phone.NANP.CA.SK, - Phone.NANP.CA.Territory] + 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.NSAndPE, + 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 3be64ff..7409083 100644 --- a/lib/phone/nanp/ca/ab.ex +++ b/lib/phone/nanp/ca/ab.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.CA.AB do def area_type, do: "province" def area_abbreviation, do: "AB" - matcher ["1403", "1780", "1587", "1825"] + matcher(["1403", "1780", "1587", "1825"]) end diff --git a/lib/phone/nanp/ca/bc.ex b/lib/phone/nanp/ca/bc.ex index 74fadf4..7dd3f18 100644 --- a/lib/phone/nanp/ca/bc.ex +++ b/lib/phone/nanp/ca/bc.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.CA.BC do def area_type, do: "province" def area_abbreviation, do: "BC" - matcher ["1604", "1778", "1236", "1250"] + matcher(["1604", "1778", "1236", "1250"]) end diff --git a/lib/phone/nanp/ca/mb.ex b/lib/phone/nanp/ca/mb.ex index f987938..6caad65 100644 --- a/lib/phone/nanp/ca/mb.ex +++ b/lib/phone/nanp/ca/mb.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.CA.MB do def area_type, do: "province" def area_abbreviation, do: "MB" - matcher ["1204", "1431"] + matcher(["1204", "1431"]) end diff --git a/lib/phone/nanp/ca/nb.ex b/lib/phone/nanp/ca/nb.ex index ec70ee9..8132695 100644 --- a/lib/phone/nanp/ca/nb.ex +++ b/lib/phone/nanp/ca/nb.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.CA.NB do def area_type, do: "province" def area_abbreviation, do: "NB" - matcher ["1506"] + matcher(["1506"]) end diff --git a/lib/phone/nanp/ca/nl.ex b/lib/phone/nanp/ca/nl.ex index 30b02c4..6eef8b0 100644 --- a/lib/phone/nanp/ca/nl.ex +++ b/lib/phone/nanp/ca/nl.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.CA.NL do def area_type, do: "province" def area_abbreviation, do: "NL" - matcher ["1709"] + matcher(["1709"]) end diff --git a/lib/phone/nanp/ca/ns_and_pe.ex b/lib/phone/nanp/ca/ns_and_pe.ex index 1aa7d9c..b6535c1 100644 --- a/lib/phone/nanp/ca/ns_and_pe.ex +++ b/lib/phone/nanp/ca/ns_and_pe.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.CA.NSAndPE do def area_type, do: "provinces" def area_abbreviation, do: ["NS", "PE"] - matcher ["1902", "1782"] + matcher(["1902", "1782"]) end diff --git a/lib/phone/nanp/ca/on.ex b/lib/phone/nanp/ca/on.ex index ada92ce..e754260 100644 --- a/lib/phone/nanp/ca/on.ex +++ b/lib/phone/nanp/ca/on.ex @@ -8,6 +8,20 @@ defmodule Phone.NANP.CA.ON do 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"] + 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 c67d61f..63c9031 100644 --- a/lib/phone/nanp/ca/qc.ex +++ b/lib/phone/nanp/ca/qc.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.CA.QC do def area_type, do: "province" def area_abbreviation, do: "QC" - matcher ["1418", "1438", "1450", "1514", "1579", "1581", "1819", "1873"] + 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 b8f5cdd..d9dbaee 100644 --- a/lib/phone/nanp/ca/sk.ex +++ b/lib/phone/nanp/ca/sk.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.CA.SK do def area_type, do: "province" def area_abbreviation, do: "SK" - matcher ["1306", "1639"] + matcher(["1306", "1639"]) end diff --git a/lib/phone/nanp/ca/territory.ex b/lib/phone/nanp/ca/territory.ex index da4df12..687fb29 100644 --- a/lib/phone/nanp/ca/territory.ex +++ b/lib/phone/nanp/ca/territory.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.CA.Territory do def area_type, do: "territories" def area_abbreviation, do: ["NT", "NU", "YT"] - matcher ["1867"] + matcher(["1867"]) end diff --git a/lib/phone/nanp/dm.ex b/lib/phone/nanp/dm.ex index 1d27f30..cd9b393 100644 --- a/lib/phone/nanp/dm.ex +++ b/lib/phone/nanp/dm.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.DM do def a2, do: "DM" def a3, do: "DMA" - matcher :regex, ["1767"] + matcher(:regex, ["1767"]) end diff --git a/lib/phone/nanp/do.ex b/lib/phone/nanp/do.ex index 6edaff7..d787390 100644 --- a/lib/phone/nanp/do.ex +++ b/lib/phone/nanp/do.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.DO do def a2, do: "DO" def a3, do: "DOM" - matcher :regex, ["1809", "1829", "1849"] + matcher(:regex, ["1809", "1829", "1849"]) end diff --git a/lib/phone/nanp/gd.ex b/lib/phone/nanp/gd.ex index d5fd5ba..7bffb22 100644 --- a/lib/phone/nanp/gd.ex +++ b/lib/phone/nanp/gd.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.GD do def a2, do: "GD" def a3, do: "GRD" - matcher :regex, ["1473"] + matcher(:regex, ["1473"]) end diff --git a/lib/phone/nanp/gu.ex b/lib/phone/nanp/gu.ex index e1429d8..23d0c84 100644 --- a/lib/phone/nanp/gu.ex +++ b/lib/phone/nanp/gu.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.GU do def a2, do: "GU" def a3, do: "GUM" - matcher :regex, ["1671"] + matcher(:regex, ["1671"]) end diff --git a/lib/phone/nanp/jm.ex b/lib/phone/nanp/jm.ex index 417430f..3b3dfd4 100644 --- a/lib/phone/nanp/jm.ex +++ b/lib/phone/nanp/jm.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.JM do def a2, do: "JA" def a3, do: "JAM" - matcher :regex, ["1876"] + matcher(:regex, ["1876"]) end diff --git a/lib/phone/nanp/kn.ex b/lib/phone/nanp/kn.ex index e546b88..e02ccf9 100644 --- a/lib/phone/nanp/kn.ex +++ b/lib/phone/nanp/kn.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.KN do def a2, do: "KN" def a3, do: "KNA" - matcher :regex, ["1869"] + matcher(:regex, ["1869"]) end diff --git a/lib/phone/nanp/ky.ex b/lib/phone/nanp/ky.ex index 86848ba..4bf8705 100644 --- a/lib/phone/nanp/ky.ex +++ b/lib/phone/nanp/ky.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.KY do def a2, do: "KY" def a3, do: "CYM" - matcher :regex, ["1345"] + matcher(:regex, ["1345"]) end diff --git a/lib/phone/nanp/lc.ex b/lib/phone/nanp/lc.ex index b306bb0..f8582ec 100644 --- a/lib/phone/nanp/lc.ex +++ b/lib/phone/nanp/lc.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.LC do def a2, do: "LC" def a3, do: "LCA" - matcher :regex, ["1758"] + matcher(:regex, ["1758"]) end diff --git a/lib/phone/nanp/mp.ex b/lib/phone/nanp/mp.ex index 88817b5..7abd25b 100644 --- a/lib/phone/nanp/mp.ex +++ b/lib/phone/nanp/mp.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.MP do def a2, do: "MP" def a3, do: "MNP" - matcher :regex, ["1670"] + matcher(:regex, ["1670"]) end diff --git a/lib/phone/nanp/ms.ex b/lib/phone/nanp/ms.ex index 91a2c31..afbd82f 100644 --- a/lib/phone/nanp/ms.ex +++ b/lib/phone/nanp/ms.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.MS do def a2, do: "MS" def a3, do: "MSR" - matcher :regex, ["1664"] + matcher(:regex, ["1664"]) end diff --git a/lib/phone/nanp/pr.ex b/lib/phone/nanp/pr.ex index 076cafb..3b05b29 100644 --- a/lib/phone/nanp/pr.ex +++ b/lib/phone/nanp/pr.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.PR do def a2, do: "PR" def a3, do: "PRI" - matcher :regex, ["1787", "1939"] + matcher(:regex, ["1787", "1939"]) end diff --git a/lib/phone/nanp/sx.ex b/lib/phone/nanp/sx.ex index 18474c9..e65f22f 100644 --- a/lib/phone/nanp/sx.ex +++ b/lib/phone/nanp/sx.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.SX do def a2, do: "SX" def a3, do: "SXM" - matcher :regex, ["1721"] + matcher(:regex, ["1721"]) end diff --git a/lib/phone/nanp/tc.ex b/lib/phone/nanp/tc.ex index a94a024..7910c02 100644 --- a/lib/phone/nanp/tc.ex +++ b/lib/phone/nanp/tc.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.TC do def a2, do: "TC" def a3, do: "TCA" - matcher :regex, ["1649"] + matcher(:regex, ["1649"]) end diff --git a/lib/phone/nanp/toll_free.ex b/lib/phone/nanp/toll_free.ex index 1b12c8c..a1fc213 100644 --- a/lib/phone/nanp/toll_free.ex +++ b/lib/phone/nanp/toll_free.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.TollFree do def a2, do: "" def a3, do: "" - matcher :regex, ["1800", "1833", "1844", "1855", "1866", "1877", "1888"] + matcher(:regex, ["1800", "1833", "1844", "1855", "1866", "1877", "1888"]) end diff --git a/lib/phone/nanp/tt.ex b/lib/phone/nanp/tt.ex index 5552ff1..fa59c5b 100644 --- a/lib/phone/nanp/tt.ex +++ b/lib/phone/nanp/tt.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.TT do def a2, do: "TT" def a3, do: "TTO" - matcher :regex, ["1868"] + matcher(:regex, ["1868"]) end diff --git a/lib/phone/nanp/us.ex b/lib/phone/nanp/us.ex index 73bec33..5be5ffc 100644 --- a/lib/phone/nanp/us.ex +++ b/lib/phone/nanp/us.ex @@ -7,17 +7,57 @@ defmodule Phone.NANP.US do 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] + 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 052248e..605e675 100644 --- a/lib/phone/nanp/us/ak.ex +++ b/lib/phone/nanp/us/ak.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.AK do def area_type, do: "state" def area_abbreviation, do: "AK" - matcher ["1907"] + matcher(["1907"]) end diff --git a/lib/phone/nanp/us/al.ex b/lib/phone/nanp/us/al.ex index f9abf90..569a9dc 100644 --- a/lib/phone/nanp/us/al.ex +++ b/lib/phone/nanp/us/al.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.AL do def area_type, do: "state" def area_abbreviation, do: "AL" - matcher ["1205", "1251", "1256", "1334", "1938"] + matcher(["1205", "1251", "1256", "1334", "1938"]) end diff --git a/lib/phone/nanp/us/ar.ex b/lib/phone/nanp/us/ar.ex index a4efeb6..5c55327 100644 --- a/lib/phone/nanp/us/ar.ex +++ b/lib/phone/nanp/us/ar.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.AR do def area_type, do: "state" def area_abbreviation, do: "AR" - matcher ["1479", "1501", "1870"] + matcher(["1479", "1501", "1870"]) end diff --git a/lib/phone/nanp/us/az.ex b/lib/phone/nanp/us/az.ex index 7b58949..ee8bf22 100644 --- a/lib/phone/nanp/us/az.ex +++ b/lib/phone/nanp/us/az.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.AZ do def area_type, do: "state" def area_abbreviation, do: "AZ" - matcher ["1480", "1520", "1602", "1623", "1928"] + matcher(["1480", "1520", "1602", "1623", "1928"]) end diff --git a/lib/phone/nanp/us/ca.ex b/lib/phone/nanp/us/ca.ex index d27ac79..26e6c34 100644 --- a/lib/phone/nanp/us/ca.ex +++ b/lib/phone/nanp/us/ca.ex @@ -3,13 +3,47 @@ defmodule Phone.NANP.US.CA do use Helper.Area - def regex, do: ~r/^(1)(209|279|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 regex, + do: + ~r/^(1)(209|279|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", "1279", "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"] + matcher([ + "1209", + "1213", + "1279", + "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 06b6dea..c88cf53 100644 --- a/lib/phone/nanp/us/co.ex +++ b/lib/phone/nanp/us/co.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.CO do def area_type, do: "state" def area_abbreviation, do: "CO" - matcher ["1303", "1719", "1720", "1970"] + matcher(["1303", "1719", "1720", "1970"]) end diff --git a/lib/phone/nanp/us/ct.ex b/lib/phone/nanp/us/ct.ex index f777aee..636ba9d 100644 --- a/lib/phone/nanp/us/ct.ex +++ b/lib/phone/nanp/us/ct.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.CT do def area_type, do: "state" def area_abbreviation, do: "CT" - matcher ["1203", "1475", "1860", "1959"] + matcher(["1203", "1475", "1860", "1959"]) end diff --git a/lib/phone/nanp/us/dc.ex b/lib/phone/nanp/us/dc.ex index 36de70b..ea5ace6 100644 --- a/lib/phone/nanp/us/dc.ex +++ b/lib/phone/nanp/us/dc.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.DC do def area_type, do: "state" def area_abbreviation, do: "DC" - matcher ["1202"] + matcher(["1202"]) end diff --git a/lib/phone/nanp/us/de.ex b/lib/phone/nanp/us/de.ex index 9ad97fb..699ebac 100644 --- a/lib/phone/nanp/us/de.ex +++ b/lib/phone/nanp/us/de.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.DE do def area_type, do: "state" def area_abbreviation, do: "DE" - matcher ["1302"] + matcher(["1302"]) end diff --git a/lib/phone/nanp/us/fl.ex b/lib/phone/nanp/us/fl.ex index 7838280..8bec864 100644 --- a/lib/phone/nanp/us/fl.ex +++ b/lib/phone/nanp/us/fl.ex @@ -3,11 +3,30 @@ defmodule Phone.NANP.US.FL do use Helper.Area - 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 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"] + 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 0dea5ee..9f84cd3 100644 --- a/lib/phone/nanp/us/ga.ex +++ b/lib/phone/nanp/us/ga.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.GA do def area_type, do: "state" def area_abbreviation, do: "GA" - matcher ["1229", "1404", "1470", "1478", "1678", "1706", "1762", "1770", "1912"] + 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 a95f052..275ad40 100644 --- a/lib/phone/nanp/us/hi.ex +++ b/lib/phone/nanp/us/hi.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.HI do def area_type, do: "state" def area_abbreviation, do: "HI" - matcher ["1808"] + matcher(["1808"]) end diff --git a/lib/phone/nanp/us/ia.ex b/lib/phone/nanp/us/ia.ex index a99cd44..5a0bb8a 100644 --- a/lib/phone/nanp/us/ia.ex +++ b/lib/phone/nanp/us/ia.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.IA do def area_type, do: "state" def area_abbreviation, do: "IA" - matcher ["1319", "1515", "1563", "1641", "1712"] + matcher(["1319", "1515", "1563", "1641", "1712"]) end diff --git a/lib/phone/nanp/us/id.ex b/lib/phone/nanp/us/id.ex index fcc4009..3f70194 100644 --- a/lib/phone/nanp/us/id.ex +++ b/lib/phone/nanp/us/id.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.ID do def area_type, do: "state" def area_abbreviation, do: "ID" - matcher ["1208", "1986"] + matcher(["1208", "1986"]) end diff --git a/lib/phone/nanp/us/il.ex b/lib/phone/nanp/us/il.ex index cda49de..62d9e79 100644 --- a/lib/phone/nanp/us/il.ex +++ b/lib/phone/nanp/us/il.ex @@ -8,6 +8,19 @@ defmodule Phone.NANP.US.IL do def area_type, do: "state" def area_abbreviation, do: "IL" - matcher ["1217", "1224", "1309", "1312", "1331", "1618", "1630", "1708", "1773", - "1779", "1815", "1847", "1872"] + 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 1473418..b1bc8e9 100644 --- a/lib/phone/nanp/us/in.ex +++ b/lib/phone/nanp/us/in.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.IN do def area_type, do: "state" def area_abbreviation, do: "IN" - matcher ["1219", "1260", "1317", "1463", "1574", "1765", "1812", "1930"] + 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 8fca4d9..52769e8 100644 --- a/lib/phone/nanp/us/ks.ex +++ b/lib/phone/nanp/us/ks.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.KS do def area_type, do: "state" def area_abbreviation, do: "KS" - matcher ["1316", "1620", "1785", "1913"] + matcher(["1316", "1620", "1785", "1913"]) end diff --git a/lib/phone/nanp/us/ky.ex b/lib/phone/nanp/us/ky.ex index ab87456..1291f1a 100644 --- a/lib/phone/nanp/us/ky.ex +++ b/lib/phone/nanp/us/ky.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.KY do def area_type, do: "state" def area_abbreviation, do: "KY" - matcher ["1270", "1364", "1502", "1606", "1859"] + matcher(["1270", "1364", "1502", "1606", "1859"]) end diff --git a/lib/phone/nanp/us/la.ex b/lib/phone/nanp/us/la.ex index 9cf1cb2..261ab1a 100644 --- a/lib/phone/nanp/us/la.ex +++ b/lib/phone/nanp/us/la.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.LA do def area_type, do: "state" def area_abbreviation, do: "LA" - matcher ["1225", "1318", "1337", "1504", "1985"] + matcher(["1225", "1318", "1337", "1504", "1985"]) end diff --git a/lib/phone/nanp/us/ma.ex b/lib/phone/nanp/us/ma.ex index 67e9ecf..a519116 100644 --- a/lib/phone/nanp/us/ma.ex +++ b/lib/phone/nanp/us/ma.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.MA do def area_type, do: "state" def area_abbreviation, do: "MA" - matcher ["1339", "1351", "1413", "1508", "1617", "1774", "1781", "1857", "1978"] + 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 9bb5e82..b29c287 100644 --- a/lib/phone/nanp/us/md.ex +++ b/lib/phone/nanp/us/md.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.MD do def area_type, do: "state" def area_abbreviation, do: "MD" - matcher ["1240", "1301", "1410", "1443", "1667"] + matcher(["1240", "1301", "1410", "1443", "1667"]) end diff --git a/lib/phone/nanp/us/me.ex b/lib/phone/nanp/us/me.ex index d594c5a..6fa22b3 100644 --- a/lib/phone/nanp/us/me.ex +++ b/lib/phone/nanp/us/me.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.ME do def area_type, do: "state" def area_abbreviation, do: "ME" - matcher ["1207"] + matcher(["1207"]) end diff --git a/lib/phone/nanp/us/mi.ex b/lib/phone/nanp/us/mi.ex index 6fbbc1c..4db9eb4 100644 --- a/lib/phone/nanp/us/mi.ex +++ b/lib/phone/nanp/us/mi.ex @@ -8,6 +8,18 @@ defmodule Phone.NANP.US.MI do def area_type, do: "state" def area_abbreviation, do: "MI" - matcher ["1231", "1248", "1269", "1313", "1517", "1586", "1616", "1734", "1810", - "1906", "1947", "1989"] + 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 0282bb1..5b0f106 100644 --- a/lib/phone/nanp/us/mn.ex +++ b/lib/phone/nanp/us/mn.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.MN do def area_type, do: "state" def area_abbreviation, do: "MN" - matcher ["1218", "1320", "1507", "1612", "1651", "1763", "1952"] + 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 93dbb67..9535d7d 100644 --- a/lib/phone/nanp/us/mo.ex +++ b/lib/phone/nanp/us/mo.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.MO do def area_type, do: "state" def area_abbreviation, do: "MO" - matcher ["1314", "1417", "1573", "1636", "1660", "1816"] + 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 7eb8f62..06acc6c 100644 --- a/lib/phone/nanp/us/ms.ex +++ b/lib/phone/nanp/us/ms.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.MS do def area_type, do: "state" def area_abbreviation, do: "MS" - matcher ["1228", "1601", "1662", "1769"] + matcher(["1228", "1601", "1662", "1769"]) end diff --git a/lib/phone/nanp/us/mt.ex b/lib/phone/nanp/us/mt.ex index 68d0411..ded16bc 100644 --- a/lib/phone/nanp/us/mt.ex +++ b/lib/phone/nanp/us/mt.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.MT do def area_type, do: "state" def area_abbreviation, do: "MT" - matcher ["1406"] + matcher(["1406"]) end diff --git a/lib/phone/nanp/us/nc.ex b/lib/phone/nanp/us/nc.ex index e2ef90b..39830ee 100644 --- a/lib/phone/nanp/us/nc.ex +++ b/lib/phone/nanp/us/nc.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.NC do def area_type, do: "state" def area_abbreviation, do: "NC" - matcher ["1252", "1336", "1704", "1743", "1828", "1910", "1919", "1980", "1984"] + 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 553ce09..77ebd84 100644 --- a/lib/phone/nanp/us/nd.ex +++ b/lib/phone/nanp/us/nd.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.ND do def area_type, do: "state" def area_abbreviation, do: "ND" - matcher ["1701"] + matcher(["1701"]) end diff --git a/lib/phone/nanp/us/ne.ex b/lib/phone/nanp/us/ne.ex index 7cc9f30..e313265 100644 --- a/lib/phone/nanp/us/ne.ex +++ b/lib/phone/nanp/us/ne.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.NE do def area_type, do: "state" def area_abbreviation, do: "NE" - matcher ["1308", "1402", "1531"] + matcher(["1308", "1402", "1531"]) end diff --git a/lib/phone/nanp/us/nh.ex b/lib/phone/nanp/us/nh.ex index bdd8021..b74da00 100644 --- a/lib/phone/nanp/us/nh.ex +++ b/lib/phone/nanp/us/nh.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.NH do def area_type, do: "state" def area_abbreviation, do: "NH" - matcher ["1603"] + matcher(["1603"]) end diff --git a/lib/phone/nanp/us/nj.ex b/lib/phone/nanp/us/nj.ex index 744cfe2..22f981f 100644 --- a/lib/phone/nanp/us/nj.ex +++ b/lib/phone/nanp/us/nj.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.NJ do def area_type, do: "state" def area_abbreviation, do: "NJ" - matcher ["1201", "1551", "1609", "1732", "1848", "1856", "1862", "1908", "1973"] + 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 4136808..4a9f9eb 100644 --- a/lib/phone/nanp/us/nm.ex +++ b/lib/phone/nanp/us/nm.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.NM do def area_type, do: "state" def area_abbreviation, do: "NM" - matcher ["1505", "1575"] + matcher(["1505", "1575"]) end diff --git a/lib/phone/nanp/us/nv.ex b/lib/phone/nanp/us/nv.ex index 035551d..d393121 100644 --- a/lib/phone/nanp/us/nv.ex +++ b/lib/phone/nanp/us/nv.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.NV do def area_type, do: "state" def area_abbreviation, do: "NV" - matcher ["1702", "1725", "1775"] + matcher(["1702", "1725", "1775"]) end diff --git a/lib/phone/nanp/us/ny.ex b/lib/phone/nanp/us/ny.ex index 77b2bf9..b1d44d9 100644 --- a/lib/phone/nanp/us/ny.ex +++ b/lib/phone/nanp/us/ny.ex @@ -3,12 +3,33 @@ defmodule Phone.NANP.US.NY do use Helper.Area - def regex, do: ~r/^(1)(212|315|332|347|516|518|585|607|631|646|680|716|718|838|845|914|917|929|934)([2-9].{6})$/ + def regex, + do: + ~r/^(1)(212|315|332|347|516|518|585|607|631|646|680|716|718|838|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", "1838", "1845", "1914", "1917", "1929", - "1934"] + matcher([ + "1212", + "1315", + "1332", + "1347", + "1516", + "1518", + "1585", + "1607", + "1631", + "1646", + "1680", + "1716", + "1718", + "1838", + "1845", + "1914", + "1917", + "1929", + "1934" + ]) end diff --git a/lib/phone/nanp/us/oh.ex b/lib/phone/nanp/us/oh.ex index ae4e866..53ef1f2 100644 --- a/lib/phone/nanp/us/oh.ex +++ b/lib/phone/nanp/us/oh.ex @@ -8,6 +8,18 @@ defmodule Phone.NANP.US.OH do def area_type, do: "state" def area_abbreviation, do: "OH" - matcher ["1216", "1220", "1234", "1330", "1380", "1419", "1440", "1513", "1567", - "1614", "1740", "1937"] + 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 61a5da4..4b5f038 100644 --- a/lib/phone/nanp/us/ok.ex +++ b/lib/phone/nanp/us/ok.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.OK do def area_type, do: "state" def area_abbreviation, do: "OK" - matcher ["1405", "1539", "1580", "1918"] + matcher(["1405", "1539", "1580", "1918"]) end diff --git a/lib/phone/nanp/us/or.ex b/lib/phone/nanp/us/or.ex index 96767bd..32e6bf8 100644 --- a/lib/phone/nanp/us/or.ex +++ b/lib/phone/nanp/us/or.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.OR do def area_type, do: "state" def area_abbreviation, do: "OR" - matcher ["1458", "1503", "1541", "1971"] + matcher(["1458", "1503", "1541", "1971"]) end diff --git a/lib/phone/nanp/us/pa.ex b/lib/phone/nanp/us/pa.ex index 5c6aff7..dd80038 100644 --- a/lib/phone/nanp/us/pa.ex +++ b/lib/phone/nanp/us/pa.ex @@ -8,6 +8,19 @@ defmodule Phone.NANP.US.PA do def area_type, do: "state" def area_abbreviation, do: "PA" - matcher ["1215", "1223", "1267", "1272", "1412", "1445", "1484", "1570", "1610", - "1717", "1724", "1814", "1878"] + matcher([ + "1215", + "1223", + "1267", + "1272", + "1412", + "1445", + "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 9a566ba..b75bb59 100644 --- a/lib/phone/nanp/us/ri.ex +++ b/lib/phone/nanp/us/ri.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.RI do def area_type, do: "state" def area_abbreviation, do: "RI" - matcher ["1401"] + matcher(["1401"]) end diff --git a/lib/phone/nanp/us/sc.ex b/lib/phone/nanp/us/sc.ex index 6cee11b..9f73e92 100644 --- a/lib/phone/nanp/us/sc.ex +++ b/lib/phone/nanp/us/sc.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.SC do def area_type, do: "state" def area_abbreviation, do: "SC" - matcher ["1803", "1843", "1854", "1864"] + matcher(["1803", "1843", "1854", "1864"]) end diff --git a/lib/phone/nanp/us/sd.ex b/lib/phone/nanp/us/sd.ex index 1474559..5589ab3 100644 --- a/lib/phone/nanp/us/sd.ex +++ b/lib/phone/nanp/us/sd.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.SD do def area_type, do: "state" def area_abbreviation, do: "SD" - matcher ["1605"] + matcher(["1605"]) end diff --git a/lib/phone/nanp/us/tn.ex b/lib/phone/nanp/us/tn.ex index efe6672..779a900 100644 --- a/lib/phone/nanp/us/tn.ex +++ b/lib/phone/nanp/us/tn.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.TN do def area_type, do: "state" def area_abbreviation, do: "TN" - matcher ["1423", "1615", "1629", "1731", "1865", "1901", "1931"] + 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 b58334e..b54b9b7 100644 --- a/lib/phone/nanp/us/tx.ex +++ b/lib/phone/nanp/us/tx.ex @@ -3,12 +3,41 @@ defmodule Phone.NANP.US.TX do use Helper.Area - def regex, do: ~r/^(1)(210|214|254|281|325|346|361|409|430|432|469|512|682|713|726|737|806|817|830|832|903|915|936|940|956|972|979)([2-9].{6})$/ + def regex, + do: + ~r/^(1)(210|214|254|281|325|346|361|409|430|432|469|512|682|713|726|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", "1726", "1737", "1806", "1817", - "1830", "1832", "1903", "1915", "1936", "1940", "1956", "1972", "1979"] + matcher([ + "1210", + "1214", + "1254", + "1281", + "1325", + "1346", + "1361", + "1409", + "1430", + "1432", + "1469", + "1512", + "1682", + "1713", + "1726", + "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 e980698..f6af405 100644 --- a/lib/phone/nanp/us/ut.ex +++ b/lib/phone/nanp/us/ut.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.UT do def area_type, do: "state" def area_abbreviation, do: "UT" - matcher ["1385", "1435", "1801"] + matcher(["1385", "1435", "1801"]) end diff --git a/lib/phone/nanp/us/va.ex b/lib/phone/nanp/us/va.ex index a8883fd..c650cbf 100644 --- a/lib/phone/nanp/us/va.ex +++ b/lib/phone/nanp/us/va.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.VA do def area_type, do: "state" def area_abbreviation, do: "VA" - matcher ["1276", "1434", "1540", "1571", "1703", "1757", "1804"] + 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 fd607ca..f800d2d 100644 --- a/lib/phone/nanp/us/vt.ex +++ b/lib/phone/nanp/us/vt.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.VT do def area_type, do: "state" def area_abbreviation, do: "VT" - matcher ["1802"] + matcher(["1802"]) end diff --git a/lib/phone/nanp/us/wa.ex b/lib/phone/nanp/us/wa.ex index 6e75ed4..2f04586 100644 --- a/lib/phone/nanp/us/wa.ex +++ b/lib/phone/nanp/us/wa.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.WA do def area_type, do: "state" def area_abbreviation, do: "WA" - matcher ["1206", "1253", "1360", "1425", "1509", "1564"] + matcher(["1206", "1253", "1360", "1425", "1509", "1564"]) end diff --git a/lib/phone/nanp/us/wi.ex b/lib/phone/nanp/us/wi.ex index 7670bdf..dea12bc 100644 --- a/lib/phone/nanp/us/wi.ex +++ b/lib/phone/nanp/us/wi.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.WI do def area_type, do: "state" def area_abbreviation, do: "WI" - matcher ["1262", "1414", "1534", "1608", "1715", "1920"] + 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 ac29057..bb6ce77 100644 --- a/lib/phone/nanp/us/wv.ex +++ b/lib/phone/nanp/us/wv.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.WV do def area_type, do: "state" def area_abbreviation, do: "WV" - matcher ["1304", "1681"] + matcher(["1304", "1681"]) end diff --git a/lib/phone/nanp/us/wy.ex b/lib/phone/nanp/us/wy.ex index a78515e..c71ca6a 100644 --- a/lib/phone/nanp/us/wy.ex +++ b/lib/phone/nanp/us/wy.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.US.WY do def area_type, do: "state" def area_abbreviation, do: "WY" - matcher ["1307"] + matcher(["1307"]) end diff --git a/lib/phone/nanp/vc.ex b/lib/phone/nanp/vc.ex index 8160e71..eebebe3 100644 --- a/lib/phone/nanp/vc.ex +++ b/lib/phone/nanp/vc.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.VC do def a2, do: "VC" def a3, do: "VCT" - matcher :regex, ["1784"] + matcher(:regex, ["1784"]) end diff --git a/lib/phone/nanp/vg.ex b/lib/phone/nanp/vg.ex index 4c5f6b9..7d136e1 100644 --- a/lib/phone/nanp/vg.ex +++ b/lib/phone/nanp/vg.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.VG do def a2, do: "VG" def a3, do: "VGB" - matcher :regex, ["1284"] + matcher(:regex, ["1284"]) end diff --git a/lib/phone/nanp/vi.ex b/lib/phone/nanp/vi.ex index 66c13d9..9f69b34 100644 --- a/lib/phone/nanp/vi.ex +++ b/lib/phone/nanp/vi.ex @@ -8,5 +8,5 @@ defmodule Phone.NANP.VI do def a2, do: "VI" def a3, do: "VIR" - matcher :regex, ["1340"] + matcher(:regex, ["1340"]) end diff --git a/lib/phone/nc.ex b/lib/phone/nc.ex index ef90791..43b93c8 100644 --- a/lib/phone/nc.ex +++ b/lib/phone/nc.ex @@ -8,5 +8,5 @@ defmodule Phone.NC do def a2, do: "NC" def a3, do: "NCL" - matcher :regex, ["687"] + matcher(:regex, ["687"]) end diff --git a/lib/phone/ne.ex b/lib/phone/ne.ex index 472dc28..a827286 100644 --- a/lib/phone/ne.ex +++ b/lib/phone/ne.ex @@ -8,5 +8,5 @@ defmodule Phone.NE do def a2, do: "NE" def a3, do: "NER" - matcher :regex, ["227"] + matcher(:regex, ["227"]) end diff --git a/lib/phone/ng.ex b/lib/phone/ng.ex index debcc35..3ee16a1 100644 --- a/lib/phone/ng.ex +++ b/lib/phone/ng.ex @@ -8,5 +8,5 @@ defmodule Phone.NG do def a2, do: "NG" def a3, do: "NGA" - matcher :regex, ["234"] + matcher(:regex, ["234"]) end diff --git a/lib/phone/ni.ex b/lib/phone/ni.ex index bff6d9c..b7a3c4c 100644 --- a/lib/phone/ni.ex +++ b/lib/phone/ni.ex @@ -8,5 +8,5 @@ defmodule Phone.NI do def a2, do: "NI" def a3, do: "NIC" - matcher :regex, ["505"] + matcher(:regex, ["505"]) end diff --git a/lib/phone/nl.ex b/lib/phone/nl.ex index 37e6262..5e22096 100644 --- a/lib/phone/nl.ex +++ b/lib/phone/nl.ex @@ -8,5 +8,5 @@ defmodule Phone.NL do def a2, do: "NL" def a3, do: "NLD" - matcher :regex, ["31"] + matcher(:regex, ["31"]) end diff --git a/lib/phone/no.ex b/lib/phone/no.ex index 1648711..346a9a8 100644 --- a/lib/phone/no.ex +++ b/lib/phone/no.ex @@ -8,5 +8,5 @@ defmodule Phone.NO do def a2, do: "NO" def a3, do: "NOR" - matcher :regex, ["47"] + matcher(:regex, ["47"]) end diff --git a/lib/phone/np.ex b/lib/phone/np.ex index 1e326aa..fd0066f 100644 --- a/lib/phone/np.ex +++ b/lib/phone/np.ex @@ -8,5 +8,5 @@ defmodule Phone.NP do def a2, do: "NP" def a3, do: "NPL" - matcher :regex, ["977"] + matcher(:regex, ["977"]) end diff --git a/lib/phone/nr.ex b/lib/phone/nr.ex index 5b6dc84..0bad402 100644 --- a/lib/phone/nr.ex +++ b/lib/phone/nr.ex @@ -8,5 +8,5 @@ defmodule Phone.NR do def a2, do: "NR" def a3, do: "NRU" - matcher :regex, ["674"] + matcher(:regex, ["674"]) end diff --git a/lib/phone/nu.ex b/lib/phone/nu.ex index 814d248..532bf51 100644 --- a/lib/phone/nu.ex +++ b/lib/phone/nu.ex @@ -8,5 +8,5 @@ defmodule Phone.NU do def a2, do: "NU" def a3, do: "NIU" - matcher :regex, ["683"] + matcher(:regex, ["683"]) end diff --git a/lib/phone/nz.ex b/lib/phone/nz.ex index b9caf63..d8b22e8 100644 --- a/lib/phone/nz.ex +++ b/lib/phone/nz.ex @@ -8,5 +8,5 @@ defmodule Phone.NZ do def a2, do: "NZ" def a3, do: "NZL" - matcher :regex, ["64"] + matcher(:regex, ["64"]) end diff --git a/lib/phone/om.ex b/lib/phone/om.ex index 96f71b8..7c4ec27 100644 --- a/lib/phone/om.ex +++ b/lib/phone/om.ex @@ -8,5 +8,5 @@ defmodule Phone.OM do def a2, do: "OM" def a3, do: "OMN" - matcher :regex, ["968"] + matcher(:regex, ["968"]) end diff --git a/lib/phone/pa.ex b/lib/phone/pa.ex index d77421e..5cc494e 100644 --- a/lib/phone/pa.ex +++ b/lib/phone/pa.ex @@ -8,5 +8,5 @@ defmodule Phone.PA do def a2, do: "PA" def a3, do: "PAN" - matcher :regex, ["507"] + matcher(:regex, ["507"]) end diff --git a/lib/phone/pe.ex b/lib/phone/pe.ex index 83978f5..7fee27a 100644 --- a/lib/phone/pe.ex +++ b/lib/phone/pe.ex @@ -8,5 +8,5 @@ defmodule Phone.PE do def a2, do: "PE" def a3, do: "PER" - matcher :regex, ["51"] + matcher(:regex, ["51"]) end diff --git a/lib/phone/pf.ex b/lib/phone/pf.ex index e8f1935..bd13864 100644 --- a/lib/phone/pf.ex +++ b/lib/phone/pf.ex @@ -8,5 +8,5 @@ defmodule Phone.PF do def a2, do: "PF" def a3, do: "PYF" - matcher :regex, ["689"] + matcher(:regex, ["689"]) end diff --git a/lib/phone/pg.ex b/lib/phone/pg.ex index cda7a0f..91b16a7 100644 --- a/lib/phone/pg.ex +++ b/lib/phone/pg.ex @@ -8,5 +8,5 @@ defmodule Phone.PG do def a2, do: "PG" def a3, do: "PNG" - matcher :regex, ["675"] + matcher(:regex, ["675"]) end diff --git a/lib/phone/ph.ex b/lib/phone/ph.ex index e044aee..4e580ac 100644 --- a/lib/phone/ph.ex +++ b/lib/phone/ph.ex @@ -8,5 +8,5 @@ defmodule Phone.PH do def a2, do: "PH" def a3, do: "PHL" - matcher :regex, ["63"] + matcher(:regex, ["63"]) end diff --git a/lib/phone/pk.ex b/lib/phone/pk.ex index 9ec98de..6ca8355 100644 --- a/lib/phone/pk.ex +++ b/lib/phone/pk.ex @@ -8,5 +8,5 @@ defmodule Phone.PK do def a2, do: "PK" def a3, do: "PAK" - matcher :regex, ["92"] + matcher(:regex, ["92"]) end diff --git a/lib/phone/pl.ex b/lib/phone/pl.ex index 62e97d1..8d72e75 100644 --- a/lib/phone/pl.ex +++ b/lib/phone/pl.ex @@ -8,5 +8,5 @@ defmodule Phone.PL do def a2, do: "PL" def a3, do: "POL" - matcher :regex, ["48"] + matcher(:regex, ["48"]) end diff --git a/lib/phone/pm.ex b/lib/phone/pm.ex index 1f5ce69..86a9fe7 100644 --- a/lib/phone/pm.ex +++ b/lib/phone/pm.ex @@ -8,5 +8,5 @@ defmodule Phone.PM do def a2, do: "PM" def a3, do: "SPM" - matcher :regex, ["508"] + matcher(:regex, ["508"]) end diff --git a/lib/phone/ps.ex b/lib/phone/ps.ex index dc0eac6..8870aec 100644 --- a/lib/phone/ps.ex +++ b/lib/phone/ps.ex @@ -9,5 +9,5 @@ defmodule Phone.PS do def a2, do: "DJ" def a3, do: "DJI" - matcher :regex, ["970"] + matcher(:regex, ["970"]) end diff --git a/lib/phone/pt.ex b/lib/phone/pt.ex index c6ef532..74557ea 100644 --- a/lib/phone/pt.ex +++ b/lib/phone/pt.ex @@ -8,5 +8,5 @@ defmodule Phone.PT do def a2, do: "PT" def a3, do: "PRT" - matcher :regex, ["351"] + matcher(:regex, ["351"]) end diff --git a/lib/phone/pw.ex b/lib/phone/pw.ex index 740389f..63eaf8e 100644 --- a/lib/phone/pw.ex +++ b/lib/phone/pw.ex @@ -8,5 +8,5 @@ defmodule Phone.PW do def a2, do: "PW" def a3, do: "PLW" - matcher :regex, ["680"] + matcher(:regex, ["680"]) end diff --git a/lib/phone/py.ex b/lib/phone/py.ex index 3df44f3..3ebcfdc 100644 --- a/lib/phone/py.ex +++ b/lib/phone/py.ex @@ -8,5 +8,5 @@ defmodule Phone.PY do def a2, do: "PY" def a3, do: "PRY" - matcher :regex, ["595"] + matcher(:regex, ["595"]) end diff --git a/lib/phone/qa.ex b/lib/phone/qa.ex index 965586d..aa0a37c 100644 --- a/lib/phone/qa.ex +++ b/lib/phone/qa.ex @@ -8,5 +8,5 @@ defmodule Phone.QA do def a2, do: "QA" def a3, do: "QAT" - matcher :regex, ["974"] + matcher(:regex, ["974"]) end diff --git a/lib/phone/ro.ex b/lib/phone/ro.ex index 4b52369..a790633 100644 --- a/lib/phone/ro.ex +++ b/lib/phone/ro.ex @@ -8,5 +8,5 @@ defmodule Phone.RO do def a2, do: "RO" def a3, do: "ROU" - matcher :regex, ["40"] + matcher(:regex, ["40"]) end diff --git a/lib/phone/rs.ex b/lib/phone/rs.ex index 5be04d0..b2931d3 100644 --- a/lib/phone/rs.ex +++ b/lib/phone/rs.ex @@ -8,5 +8,5 @@ defmodule Phone.RS do def a2, do: "RS" def a3, do: "SRB" - matcher :regex, ["381"] + matcher(:regex, ["381"]) end diff --git a/lib/phone/ru.ex b/lib/phone/ru.ex index d6685fd..9341a60 100644 --- a/lib/phone/ru.ex +++ b/lib/phone/ru.ex @@ -8,5 +8,5 @@ defmodule Phone.RU do def a2, do: "RU" def a3, do: "RUS" - matcher :regex, ["73", "75", "78", "79"] + matcher(:regex, ["73", "75", "78", "79"]) end diff --git a/lib/phone/rw.ex b/lib/phone/rw.ex index e678bf0..4379616 100644 --- a/lib/phone/rw.ex +++ b/lib/phone/rw.ex @@ -8,5 +8,5 @@ defmodule Phone.RW do def a2, do: "RW" def a3, do: "RWA" - matcher :regex, ["250"] + matcher(:regex, ["250"]) end diff --git a/lib/phone/sa.ex b/lib/phone/sa.ex index 6f0e578..fc5b952 100644 --- a/lib/phone/sa.ex +++ b/lib/phone/sa.ex @@ -8,5 +8,5 @@ defmodule Phone.SA do def a2, do: "SA" def a3, do: "SAU" - matcher :regex, ["966"] + matcher(:regex, ["966"]) end diff --git a/lib/phone/sb.ex b/lib/phone/sb.ex index 86e302f..d4c5cb6 100644 --- a/lib/phone/sb.ex +++ b/lib/phone/sb.ex @@ -8,5 +8,5 @@ defmodule Phone.SB do def a2, do: "SB" def a3, do: "SLB" - matcher :regex, ["677"] + matcher(:regex, ["677"]) end diff --git a/lib/phone/sc.ex b/lib/phone/sc.ex index 9d074c1..bbca7e5 100644 --- a/lib/phone/sc.ex +++ b/lib/phone/sc.ex @@ -8,5 +8,5 @@ defmodule Phone.SC do def a2, do: "SC" def a3, do: "SYC" - matcher :regex, ["248:"] + matcher(:regex, ["248:"]) end diff --git a/lib/phone/sd.ex b/lib/phone/sd.ex index 45e09c9..a89d3c9 100644 --- a/lib/phone/sd.ex +++ b/lib/phone/sd.ex @@ -8,5 +8,5 @@ defmodule Phone.SD do def a2, do: "SD" def a3, do: "SDN" - matcher :regex, ["249"] + matcher(:regex, ["249"]) end diff --git a/lib/phone/se.ex b/lib/phone/se.ex index 2380e63..6f055b0 100644 --- a/lib/phone/se.ex +++ b/lib/phone/se.ex @@ -8,5 +8,5 @@ defmodule Phone.SE do def a2, do: "SE" def a3, do: "SWE" - matcher :regex, ["46"] + matcher(:regex, ["46"]) end diff --git a/lib/phone/sg.ex b/lib/phone/sg.ex index afcc428..5211329 100644 --- a/lib/phone/sg.ex +++ b/lib/phone/sg.ex @@ -8,5 +8,5 @@ defmodule Phone.SG do def a2, do: "SG" def a3, do: "SGP" - matcher :regex, ["65"] + matcher(:regex, ["65"]) end diff --git a/lib/phone/sh.ex b/lib/phone/sh.ex index e009bef..ac78162 100644 --- a/lib/phone/sh.ex +++ b/lib/phone/sh.ex @@ -8,5 +8,5 @@ defmodule Phone.SH do def a2, do: "SH" def a3, do: "SHN" - matcher :regex, ["290"] + matcher(:regex, ["290"]) end diff --git a/lib/phone/si.ex b/lib/phone/si.ex index 8852dbb..ecb0b4d 100644 --- a/lib/phone/si.ex +++ b/lib/phone/si.ex @@ -8,5 +8,5 @@ defmodule Phone.SI do def a2, do: "SI" def a3, do: "SVN" - matcher :regex, ["386"] + matcher(:regex, ["386"]) end diff --git a/lib/phone/sk.ex b/lib/phone/sk.ex index b918ddc..eb511f8 100644 --- a/lib/phone/sk.ex +++ b/lib/phone/sk.ex @@ -8,5 +8,5 @@ defmodule Phone.SK do def a2, do: "SK" def a3, do: "SVK" - matcher :regex, ["421"] + matcher(:regex, ["421"]) end diff --git a/lib/phone/sl.ex b/lib/phone/sl.ex index 717fdc6..5ad7b3d 100644 --- a/lib/phone/sl.ex +++ b/lib/phone/sl.ex @@ -8,5 +8,5 @@ defmodule Phone.SL do def a2, do: "SL" def a3, do: "SLE" - matcher :regex, ["232"] + matcher(:regex, ["232"]) end diff --git a/lib/phone/sm.ex b/lib/phone/sm.ex index 28c867d..2d4f4fd 100644 --- a/lib/phone/sm.ex +++ b/lib/phone/sm.ex @@ -8,5 +8,5 @@ defmodule Phone.SM do def a2, do: "SM" def a3, do: "SMR" - matcher :regex, ["3780549"] + matcher(:regex, ["3780549"]) end diff --git a/lib/phone/sn.ex b/lib/phone/sn.ex index 0d62660..7e4d2a0 100644 --- a/lib/phone/sn.ex +++ b/lib/phone/sn.ex @@ -8,5 +8,5 @@ defmodule Phone.SN do def a2, do: "SN" def a3, do: "SEN" - matcher :regex, ["221"] + matcher(:regex, ["221"]) end diff --git a/lib/phone/so.ex b/lib/phone/so.ex index b71d716..4ed39c0 100644 --- a/lib/phone/so.ex +++ b/lib/phone/so.ex @@ -8,5 +8,5 @@ defmodule Phone.SO do def a2, do: "SO" def a3, do: "SOM" - matcher :regex, ["252"] + matcher(:regex, ["252"]) end diff --git a/lib/phone/sr.ex b/lib/phone/sr.ex index fa565ba..2fa5904 100644 --- a/lib/phone/sr.ex +++ b/lib/phone/sr.ex @@ -8,5 +8,5 @@ defmodule Phone.SR do def a2, do: "SR" def a3, do: "SUR" - matcher :regex, ["597"] + matcher(:regex, ["597"]) end diff --git a/lib/phone/ss.ex b/lib/phone/ss.ex index 25e054b..37b7e8b 100644 --- a/lib/phone/ss.ex +++ b/lib/phone/ss.ex @@ -8,5 +8,5 @@ defmodule Phone.SS do def a2, do: "SS" def a3, do: "SSD" - matcher :regex, ["211"] + matcher(:regex, ["211"]) end diff --git a/lib/phone/st.ex b/lib/phone/st.ex index 9b36b86..6b538b7 100644 --- a/lib/phone/st.ex +++ b/lib/phone/st.ex @@ -8,5 +8,5 @@ defmodule Phone.ST do def a2, do: "ST" def a3, do: "STP" - matcher :regex, ["239"] + matcher(:regex, ["239"]) end diff --git a/lib/phone/sv.ex b/lib/phone/sv.ex index af42bf7..431711a 100644 --- a/lib/phone/sv.ex +++ b/lib/phone/sv.ex @@ -8,5 +8,5 @@ defmodule Phone.SV do def a2, do: "SV" def a3, do: "SLV" - matcher :regex, ["503"] + matcher(:regex, ["503"]) end diff --git a/lib/phone/sy.ex b/lib/phone/sy.ex index b7bf0d4..d8f5dce 100644 --- a/lib/phone/sy.ex +++ b/lib/phone/sy.ex @@ -8,5 +8,5 @@ defmodule Phone.SY do def a2, do: "SY" def a3, do: "SYR" - matcher :regex, ["963"] + matcher(:regex, ["963"]) end diff --git a/lib/phone/sz.ex b/lib/phone/sz.ex index 26ed854..9c482f9 100644 --- a/lib/phone/sz.ex +++ b/lib/phone/sz.ex @@ -8,5 +8,5 @@ defmodule Phone.SZ do def a2, do: "SZ" def a3, do: "SWZ" - matcher :regex, ["268"] + matcher(:regex, ["268"]) end diff --git a/lib/phone/td.ex b/lib/phone/td.ex index 1a0246c..c093515 100644 --- a/lib/phone/td.ex +++ b/lib/phone/td.ex @@ -8,5 +8,5 @@ defmodule Phone.TD do def a2, do: "TD" def a3, do: "TCD" - matcher :regex, ["235"] + matcher(:regex, ["235"]) end diff --git a/lib/phone/tg.ex b/lib/phone/tg.ex index e76ed88..be2cdd9 100644 --- a/lib/phone/tg.ex +++ b/lib/phone/tg.ex @@ -8,5 +8,5 @@ defmodule Phone.TG do def a2, do: "TG" def a3, do: "TGO" - matcher :regex, ["228"] + matcher(:regex, ["228"]) end diff --git a/lib/phone/th.ex b/lib/phone/th.ex index 3cbb677..0f8ed87 100644 --- a/lib/phone/th.ex +++ b/lib/phone/th.ex @@ -8,5 +8,5 @@ defmodule Phone.TH do def a2, do: "TH" def a3, do: "THA" - matcher :regex, ["66"] + matcher(:regex, ["66"]) end diff --git a/lib/phone/tj.ex b/lib/phone/tj.ex index 119038d..531e0d1 100644 --- a/lib/phone/tj.ex +++ b/lib/phone/tj.ex @@ -8,5 +8,5 @@ defmodule Phone.TJ do def a2, do: "TJ" def a3, do: "TJK" - matcher :regex, ["992"] + matcher(:regex, ["992"]) end diff --git a/lib/phone/tk.ex b/lib/phone/tk.ex index 4964c7e..d26cb32 100644 --- a/lib/phone/tk.ex +++ b/lib/phone/tk.ex @@ -8,5 +8,5 @@ defmodule Phone.TK do def a2, do: "TK" def a3, do: "TKL" - matcher :regex, ["690"] + matcher(:regex, ["690"]) end diff --git a/lib/phone/tl.ex b/lib/phone/tl.ex index a11eb54..4719d50 100644 --- a/lib/phone/tl.ex +++ b/lib/phone/tl.ex @@ -8,5 +8,5 @@ defmodule Phone.TL do def a2, do: "TL" def a3, do: "TLS" - matcher :regex, ["670"] + matcher(:regex, ["670"]) end diff --git a/lib/phone/tm.ex b/lib/phone/tm.ex index 6201855..ab74795 100644 --- a/lib/phone/tm.ex +++ b/lib/phone/tm.ex @@ -8,5 +8,5 @@ defmodule Phone.TM do def a2, do: "TM" def a3, do: "TKM" - matcher :regex, ["993"] + matcher(:regex, ["993"]) end diff --git a/lib/phone/tn.ex b/lib/phone/tn.ex index ad650b1..95a5c40 100644 --- a/lib/phone/tn.ex +++ b/lib/phone/tn.ex @@ -8,5 +8,5 @@ defmodule Phone.TN do def a2, do: "TN" def a3, do: "TUN" - matcher :regex, ["216"] + matcher(:regex, ["216"]) end diff --git a/lib/phone/to.ex b/lib/phone/to.ex index eb966cf..ef6305f 100644 --- a/lib/phone/to.ex +++ b/lib/phone/to.ex @@ -8,5 +8,5 @@ defmodule Phone.TO do def a2, do: "TO" def a3, do: "TON" - matcher :regex, ["676"] + matcher(:regex, ["676"]) end diff --git a/lib/phone/tr.ex b/lib/phone/tr.ex index 0ad64e6..bf3b1bc 100644 --- a/lib/phone/tr.ex +++ b/lib/phone/tr.ex @@ -8,5 +8,5 @@ defmodule Phone.TR do def a2, do: "TR" def a3, do: "TUR" - matcher :regex, ["90"] + matcher(:regex, ["90"]) end diff --git a/lib/phone/tv.ex b/lib/phone/tv.ex index 8998103..68ae817 100644 --- a/lib/phone/tv.ex +++ b/lib/phone/tv.ex @@ -8,5 +8,5 @@ defmodule Phone.TV do def a2, do: "TV" def a3, do: "TUV" - matcher :regex, ["688"] + matcher(:regex, ["688"]) end diff --git a/lib/phone/tw.ex b/lib/phone/tw.ex index 941a66d..8a53ee4 100644 --- a/lib/phone/tw.ex +++ b/lib/phone/tw.ex @@ -8,5 +8,5 @@ defmodule Phone.TW do def a2, do: "TW" def a3, do: "TWN" - matcher :regex, ["886"] + matcher(:regex, ["886"]) end diff --git a/lib/phone/tz.ex b/lib/phone/tz.ex index c2893bd..bece09d 100644 --- a/lib/phone/tz.ex +++ b/lib/phone/tz.ex @@ -8,5 +8,5 @@ defmodule Phone.TZ do def a2, do: "TZ" def a3, do: "TZA" - matcher :regex, ["255"] + matcher(:regex, ["255"]) end diff --git a/lib/phone/ua.ex b/lib/phone/ua.ex index e9162d6..4cc95de 100644 --- a/lib/phone/ua.ex +++ b/lib/phone/ua.ex @@ -8,5 +8,5 @@ defmodule Phone.UA do def a2, do: "UA" def a3, do: "UKR" - matcher :regex, ["380"] + matcher(:regex, ["380"]) end diff --git a/lib/phone/ug.ex b/lib/phone/ug.ex index 1a212c6..34c1fb5 100644 --- a/lib/phone/ug.ex +++ b/lib/phone/ug.ex @@ -8,5 +8,5 @@ defmodule Phone.UG do def a2, do: "UG" def a3, do: "UGA" - matcher :regex, ["256"] + matcher(:regex, ["256"]) end diff --git a/lib/phone/uy.ex b/lib/phone/uy.ex index 1427af1..6abc67f 100644 --- a/lib/phone/uy.ex +++ b/lib/phone/uy.ex @@ -8,5 +8,5 @@ defmodule Phone.UY do def a2, do: "UY" def a3, do: "URY" - matcher :regex, ["598"] + matcher(:regex, ["598"]) end diff --git a/lib/phone/uz.ex b/lib/phone/uz.ex index 02adcad..bbaa3ae 100644 --- a/lib/phone/uz.ex +++ b/lib/phone/uz.ex @@ -8,5 +8,5 @@ defmodule Phone.UZ do def a2, do: "UZ" def a3, do: "UZB" - matcher :regex, ["998"] + matcher(:regex, ["998"]) end diff --git a/lib/phone/ve.ex b/lib/phone/ve.ex index b188917..c4e8c88 100644 --- a/lib/phone/ve.ex +++ b/lib/phone/ve.ex @@ -8,5 +8,5 @@ defmodule Phone.VE do def a2, do: "VE" def a3, do: "VEN" - matcher :regex, ["58"] + matcher(:regex, ["58"]) end diff --git a/lib/phone/vn.ex b/lib/phone/vn.ex index 06ff1cc..c47c117 100644 --- a/lib/phone/vn.ex +++ b/lib/phone/vn.ex @@ -8,5 +8,5 @@ defmodule Phone.VN do def a2, do: "VN" def a3, do: "VNM" - matcher :regex, ["84"] + matcher(:regex, ["84"]) end diff --git a/lib/phone/vu.ex b/lib/phone/vu.ex index fc574a0..93e0264 100644 --- a/lib/phone/vu.ex +++ b/lib/phone/vu.ex @@ -8,5 +8,5 @@ defmodule Phone.VU do def a2, do: "VU" def a3, do: "VUT" - matcher :regex, ["678"] + matcher(:regex, ["678"]) end diff --git a/lib/phone/wf.ex b/lib/phone/wf.ex index a6fc811..82a7b70 100644 --- a/lib/phone/wf.ex +++ b/lib/phone/wf.ex @@ -8,5 +8,5 @@ defmodule Phone.WF do def a2, do: "WF" def a3, do: "WLF" - matcher :regex, ["681"] + matcher(:regex, ["681"]) end diff --git a/lib/phone/ws.ex b/lib/phone/ws.ex index 3c1debf..535248d 100644 --- a/lib/phone/ws.ex +++ b/lib/phone/ws.ex @@ -8,5 +8,5 @@ defmodule Phone.WS do def a2, do: "WS" def a3, do: "WSM" - matcher :regex, ["685"] + matcher(:regex, ["685"]) end diff --git a/lib/phone/ye.ex b/lib/phone/ye.ex index 16a5a44..c60a529 100644 --- a/lib/phone/ye.ex +++ b/lib/phone/ye.ex @@ -8,5 +8,5 @@ defmodule Phone.YE do def a2, do: "YE" def a3, do: "YEM" - matcher :regex, ["967"] + matcher(:regex, ["967"]) end diff --git a/lib/phone/za.ex b/lib/phone/za.ex index 58adbe0..08c5059 100644 --- a/lib/phone/za.ex +++ b/lib/phone/za.ex @@ -8,5 +8,5 @@ defmodule Phone.ZA do def a2, do: "ZA" def a3, do: "ZAF" - matcher :regex, ["27"] + matcher(:regex, ["27"]) end diff --git a/lib/phone/zm.ex b/lib/phone/zm.ex index d7793d0..4028012 100644 --- a/lib/phone/zm.ex +++ b/lib/phone/zm.ex @@ -8,5 +8,5 @@ defmodule Phone.ZM do def a2, do: "ZM" def a3, do: "ZMB" - matcher :regex, ["260"] + matcher(:regex, ["260"]) end diff --git a/lib/phone/zw.ex b/lib/phone/zw.ex index 7a927b2..07174f0 100644 --- a/lib/phone/zw.ex +++ b/lib/phone/zw.ex @@ -8,5 +8,5 @@ defmodule Phone.ZW do def a2, do: "ZW" def a3, do: "ZWE" - matcher :regex, ["263"] + matcher(:regex, ["263"]) end diff --git a/mix.exs b/mix.exs index 9867157..a84dd9d 100644 --- a/mix.exs +++ b/mix.exs @@ -2,16 +2,17 @@ defmodule Phone.Mixfile do use Mix.Project def project do - [app: :phone, - version: "0.4.2", - elixir: ">= 1.1.0", - build_embedded: Mix.env == :prod, - start_permanent: Mix.env == :prod, - description: description(), - package: package(), - source_url: "https://github.com/fcevado/phone", - deps: deps()] - ++ coverage() + [ + app: :phone, + version: "0.4.2", + elixir: ">= 1.1.0", + build_embedded: Mix.env() == :prod, + start_permanent: Mix.env() == :prod, + description: description(), + package: package(), + source_url: "https://github.com/fcevado/phone", + deps: deps() + ] ++ coverage() end defp package do @@ -37,7 +38,7 @@ defmodule Phone.Mixfile do [ test_coverage: [tool: ExCoveralls], preferred_cli_env: [ - "coveralls": :test, + coveralls: :test, "coveralls.detail": :test, "coveralls.post": :test, "coveralls.html": :test diff --git a/test/phone/a_countries/ad_test.exs b/test/phone/a_countries/ad_test.exs index cf3bc17..b37b60a 100644 --- a/test/phone/a_countries/ad_test.exs +++ b/test/phone/a_countries/ad_test.exs @@ -3,27 +3,26 @@ defmodule Phone.ADTest do main_module = Phone.AD - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} parses area code #{code}" do - assert Phone.valid?(unquote("#{code}555555")) - assert {:ok, parsed} = Phone.parse(unquote("#{code}555555")) + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} parses area code #{code}" do + assert Phone.valid?(unquote("#{code}555555")) + assert {:ok, parsed} = Phone.parse(unquote("#{code}555555")) - assert parsed.country == unquote(main_module).country - assert parsed.a2 == unquote(main_module).a2 - assert parsed.a3 == unquote(main_module).a3 - end + assert parsed.country == unquote(main_module).country + assert parsed.a2 == unquote(main_module).a2 + assert parsed.a3 == unquote(main_module).a3 + end - test "#{inspect main_module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}555")) - assert {:error, _} = Phone.parse(unquote("#{code}555")) + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}555")) + assert {:error, _} = Phone.parse(unquote("#{code}555")) - refute unquote(main_module).match?(unquote("#{code}555")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) + refute unquote(main_module).match?(unquote("#{code}555")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}555")) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}555")) end - end) + end + end) end diff --git a/test/phone/a_countries/ae_test.exs b/test/phone/a_countries/ae_test.exs index 4b5c1ec..e30853f 100644 --- a/test/phone/a_countries/ae_test.exs +++ b/test/phone/a_countries/ae_test.exs @@ -3,27 +3,26 @@ defmodule Phone.AETest do main_module = Phone.AE - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} parses area code #{code}" do - assert Phone.valid?(unquote("#{code}55555555")) - assert {:ok, parsed} = Phone.parse(unquote("#{code}55555555")) + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} parses area code #{code}" do + assert Phone.valid?(unquote("#{code}55555555")) + assert {:ok, parsed} = Phone.parse(unquote("#{code}55555555")) - assert parsed.country == unquote(main_module).country - assert parsed.a2 == unquote(main_module).a2 - assert parsed.a3 == unquote(main_module).a3 - end + assert parsed.country == unquote(main_module).country + assert parsed.a2 == unquote(main_module).a2 + assert parsed.a3 == unquote(main_module).a3 + end - test "#{inspect main_module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}555")) - assert {:error, _} = Phone.parse(unquote("#{code}555")) + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}555")) + assert {:error, _} = Phone.parse(unquote("#{code}555")) - refute unquote(main_module).match?(unquote("#{code}555")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) + refute unquote(main_module).match?(unquote("#{code}555")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}555")) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}555")) end - end) + end + end) end diff --git a/test/phone/a_countries/af_test.exs b/test/phone/a_countries/af_test.exs index 44a306f..b84c18a 100644 --- a/test/phone/a_countries/af_test.exs +++ b/test/phone/a_countries/af_test.exs @@ -3,27 +3,26 @@ defmodule Phone.AFTest do main_module = Phone.AE - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} parses area code #{code}" do - assert Phone.valid?(unquote("#{code}555555555")) - assert {:ok, parsed} = Phone.parse(unquote("#{code}555555555")) + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} parses area code #{code}" do + assert Phone.valid?(unquote("#{code}555555555")) + assert {:ok, parsed} = Phone.parse(unquote("#{code}555555555")) - assert parsed.country == unquote(main_module).country - assert parsed.a2 == unquote(main_module).a2 - assert parsed.a3 == unquote(main_module).a3 - end + assert parsed.country == unquote(main_module).country + assert parsed.a2 == unquote(main_module).a2 + assert parsed.a3 == unquote(main_module).a3 + end - test "#{inspect main_module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}555")) - assert {:error, _} = Phone.parse(unquote("#{code}555")) + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}555")) + assert {:error, _} = Phone.parse(unquote("#{code}555")) - refute unquote(main_module).match?(unquote("#{code}555")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) + refute unquote(main_module).match?(unquote("#{code}555")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}555")) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}555")) end - end) + end + end) end diff --git a/test/phone/a_countries/al_test.exs b/test/phone/a_countries/al_test.exs index 17b3aea..195dae5 100644 --- a/test/phone/a_countries/al_test.exs +++ b/test/phone/a_countries/al_test.exs @@ -3,27 +3,26 @@ defmodule Phone.ALTest do main_module = Phone.AL - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} parses area code #{code}" do - assert Phone.valid?(unquote("#{code}5555555")) - assert {:ok, parsed} = Phone.parse(unquote("#{code}5555555")) + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} parses area code #{code}" do + assert Phone.valid?(unquote("#{code}5555555")) + assert {:ok, parsed} = Phone.parse(unquote("#{code}5555555")) - assert parsed.country == unquote(main_module).country - assert parsed.a2 == unquote(main_module).a2 - assert parsed.a3 == unquote(main_module).a3 - end + assert parsed.country == unquote(main_module).country + assert parsed.a2 == unquote(main_module).a2 + assert parsed.a3 == unquote(main_module).a3 + end - test "#{inspect main_module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}555")) - assert {:error, _} = Phone.parse(unquote("#{code}555")) + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}555")) + assert {:error, _} = Phone.parse(unquote("#{code}555")) - refute unquote(main_module).match?(unquote("#{code}555")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) + refute unquote(main_module).match?(unquote("#{code}555")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}555")) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}555")) end - end) + end + end) end diff --git a/test/phone/a_countries/am_test.exs b/test/phone/a_countries/am_test.exs index ad1b4ca..e731347 100644 --- a/test/phone/a_countries/am_test.exs +++ b/test/phone/a_countries/am_test.exs @@ -3,27 +3,26 @@ defmodule Phone.AMTest do main_module = Phone.AM - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} parses area code #{code}" do - assert Phone.valid?(unquote("#{code}55555555")) - assert {:ok, parsed} = Phone.parse(unquote("#{code}55555555")) + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} parses area code #{code}" do + assert Phone.valid?(unquote("#{code}55555555")) + assert {:ok, parsed} = Phone.parse(unquote("#{code}55555555")) - assert parsed.country == unquote(main_module).country - assert parsed.a2 == unquote(main_module).a2 - assert parsed.a3 == unquote(main_module).a3 - end + assert parsed.country == unquote(main_module).country + assert parsed.a2 == unquote(main_module).a2 + assert parsed.a3 == unquote(main_module).a3 + end - test "#{inspect main_module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}555")) - assert {:error, _} = Phone.parse(unquote("#{code}555")) + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}555")) + assert {:error, _} = Phone.parse(unquote("#{code}555")) - refute unquote(main_module).match?(unquote("#{code}555")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) + refute unquote(main_module).match?(unquote("#{code}555")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}555")) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}555")) end - end) + end + end) end diff --git a/test/phone/a_countries/ao_test.exs b/test/phone/a_countries/ao_test.exs index fd6e788..7b46b99 100644 --- a/test/phone/a_countries/ao_test.exs +++ b/test/phone/a_countries/ao_test.exs @@ -3,27 +3,26 @@ defmodule Phone.AOTest do main_module = Phone.AO - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} parses area code #{code}" do - assert Phone.valid?(unquote("#{code}555555555")) - assert {:ok, parsed} = Phone.parse(unquote("#{code}555555555")) + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} parses area code #{code}" do + assert Phone.valid?(unquote("#{code}555555555")) + assert {:ok, parsed} = Phone.parse(unquote("#{code}555555555")) - assert parsed.country == unquote(main_module).country - assert parsed.a2 == unquote(main_module).a2 - assert parsed.a3 == unquote(main_module).a3 - end + assert parsed.country == unquote(main_module).country + assert parsed.a2 == unquote(main_module).a2 + assert parsed.a3 == unquote(main_module).a3 + end - test "#{inspect main_module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}555")) - assert {:error, _} = Phone.parse(unquote("#{code}555")) + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}555")) + assert {:error, _} = Phone.parse(unquote("#{code}555")) - refute unquote(main_module).match?(unquote("#{code}555")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) + refute unquote(main_module).match?(unquote("#{code}555")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}555")) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}555")) end - end) + end + end) end diff --git a/test/phone/a_countries/ar_test.exs b/test/phone/a_countries/ar_test.exs index b9ebce7..b4981e0 100644 --- a/test/phone/a_countries/ar_test.exs +++ b/test/phone/a_countries/ar_test.exs @@ -3,27 +3,26 @@ defmodule Phone.ARTest do main_module = Phone.AR - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} parses area code #{code}" do - assert Phone.valid?(unquote("#{code}5555555555")) - assert {:ok, parsed} = Phone.parse(unquote("#{code}5555555555")) + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} parses area code #{code}" do + assert Phone.valid?(unquote("#{code}5555555555")) + assert {:ok, parsed} = Phone.parse(unquote("#{code}5555555555")) - assert parsed.country == unquote(main_module).country - assert parsed.a2 == unquote(main_module).a2 - assert parsed.a3 == unquote(main_module).a3 - end + assert parsed.country == unquote(main_module).country + assert parsed.a2 == unquote(main_module).a2 + assert parsed.a3 == unquote(main_module).a3 + end - test "#{inspect main_module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}555")) - assert {:error, _} = Phone.parse(unquote("#{code}555")) + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}555")) + assert {:error, _} = Phone.parse(unquote("#{code}555")) - refute unquote(main_module).match?(unquote("#{code}555")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) + refute unquote(main_module).match?(unquote("#{code}555")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}555")) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}555")) end - end) + end + end) end diff --git a/test/phone/a_countries/at_test.exs b/test/phone/a_countries/at_test.exs index b12bf6a..2e00722 100644 --- a/test/phone/a_countries/at_test.exs +++ b/test/phone/a_countries/at_test.exs @@ -3,27 +3,26 @@ defmodule Phone.ATTest do main_module = Phone.AT - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} parses area code #{code}" do - assert Phone.valid?(unquote("#{code}99")) - assert {:ok, parsed} = Phone.parse(unquote("#{code}99")) + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} parses area code #{code}" do + assert Phone.valid?(unquote("#{code}99")) + assert {:ok, parsed} = Phone.parse(unquote("#{code}99")) - assert parsed.country == unquote(main_module).country - assert parsed.a2 == unquote(main_module).a2 - assert parsed.a3 == unquote(main_module).a3 - end + assert parsed.country == unquote(main_module).country + assert parsed.a2 == unquote(main_module).a2 + assert parsed.a3 == unquote(main_module).a3 + end - test "#{inspect main_module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}")) - assert {:error, _} = Phone.parse(unquote("#{code}")) + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}")) + assert {:error, _} = Phone.parse(unquote("#{code}")) - refute unquote(main_module).match?(unquote("#{code}")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}")) + refute unquote(main_module).match?(unquote("#{code}")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}")) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}")) end - end) + end + end) end diff --git a/test/phone/a_countries/au_test.exs b/test/phone/a_countries/au_test.exs index fe52baa..dd78699 100644 --- a/test/phone/a_countries/au_test.exs +++ b/test/phone/a_countries/au_test.exs @@ -3,27 +3,26 @@ defmodule Phone.AUTest do main_module = Phone.AU - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} parses area code #{code}" do - assert Phone.valid?(unquote("#{code}55555555")) - assert {:ok, parsed} = Phone.parse(unquote("#{code}55555555")) + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} parses area code #{code}" do + assert Phone.valid?(unquote("#{code}55555555")) + assert {:ok, parsed} = Phone.parse(unquote("#{code}55555555")) - assert parsed.country == unquote(main_module).country - assert parsed.a2 == unquote(main_module).a2 - assert parsed.a3 == unquote(main_module).a3 - end + assert parsed.country == unquote(main_module).country + assert parsed.a2 == unquote(main_module).a2 + assert parsed.a3 == unquote(main_module).a3 + end - test "#{inspect main_module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}555")) - assert {:error, _} = Phone.parse(unquote("#{code}555")) + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}555")) + assert {:error, _} = Phone.parse(unquote("#{code}555")) - refute unquote(main_module).match?(unquote("#{code}555")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) + refute unquote(main_module).match?(unquote("#{code}555")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}555")) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}555")) end - end) + end + end) end diff --git a/test/phone/a_countries/aw_test.exs b/test/phone/a_countries/aw_test.exs index 30f0063..fc5d889 100644 --- a/test/phone/a_countries/aw_test.exs +++ b/test/phone/a_countries/aw_test.exs @@ -3,27 +3,26 @@ defmodule Phone.AWTest do main_module = Phone.AW - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} parses area code #{code}" do - assert Phone.valid?(unquote("#{code}5555555")) - assert {:ok, parsed} = Phone.parse(unquote("#{code}5555555")) + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} parses area code #{code}" do + assert Phone.valid?(unquote("#{code}5555555")) + assert {:ok, parsed} = Phone.parse(unquote("#{code}5555555")) - assert parsed.country == unquote(main_module).country - assert parsed.a2 == unquote(main_module).a2 - assert parsed.a3 == unquote(main_module).a3 - end + assert parsed.country == unquote(main_module).country + assert parsed.a2 == unquote(main_module).a2 + assert parsed.a3 == unquote(main_module).a3 + end - test "#{inspect main_module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}555")) - assert {:error, _} = Phone.parse(unquote("#{code}555")) + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}555")) + assert {:error, _} = Phone.parse(unquote("#{code}555")) - refute unquote(main_module).match?(unquote("#{code}555")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) + refute unquote(main_module).match?(unquote("#{code}555")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}555")) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}555")) end - end) + end + end) end diff --git a/test/phone/a_countries/az_test.exs b/test/phone/a_countries/az_test.exs index f437e1c..3e7e240 100644 --- a/test/phone/a_countries/az_test.exs +++ b/test/phone/a_countries/az_test.exs @@ -3,27 +3,26 @@ defmodule Phone.AZTest do main_module = Phone.AZ - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} parses area code #{code}" do - assert Phone.valid?(unquote("#{code}555555555")) - assert {:ok, parsed} = Phone.parse(unquote("#{code}555555555")) + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} parses area code #{code}" do + assert Phone.valid?(unquote("#{code}555555555")) + assert {:ok, parsed} = Phone.parse(unquote("#{code}555555555")) - assert parsed.country == unquote(main_module).country - assert parsed.a2 == unquote(main_module).a2 - assert parsed.a3 == unquote(main_module).a3 - end + assert parsed.country == unquote(main_module).country + assert parsed.a2 == unquote(main_module).a2 + assert parsed.a3 == unquote(main_module).a3 + end - test "#{inspect main_module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}555")) - assert {:error, _} = Phone.parse(unquote("#{code}555")) + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}555")) + assert {:error, _} = Phone.parse(unquote("#{code}555")) - refute unquote(main_module).match?(unquote("#{code}555")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) + refute unquote(main_module).match?(unquote("#{code}555")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}555")) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}555")) end - end) + end + end) end diff --git a/test/phone/b_countries/ba_test.exs b/test/phone/b_countries/ba_test.exs index dbf8bc5..88fb3ce 100644 --- a/test/phone/b_countries/ba_test.exs +++ b/test/phone/b_countries/ba_test.exs @@ -3,27 +3,26 @@ defmodule Phone.BATest do main_module = Phone.BA - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} parses area code #{code}" do - assert Phone.valid?(unquote("#{code}55555555")) - assert {:ok, parsed} = Phone.parse(unquote("#{code}55555555")) + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} parses area code #{code}" do + assert Phone.valid?(unquote("#{code}55555555")) + assert {:ok, parsed} = Phone.parse(unquote("#{code}55555555")) - assert parsed.country == unquote(main_module).country - assert parsed.a2 == unquote(main_module).a2 - assert parsed.a3 == unquote(main_module).a3 - end + assert parsed.country == unquote(main_module).country + assert parsed.a2 == unquote(main_module).a2 + assert parsed.a3 == unquote(main_module).a3 + end - test "#{inspect main_module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}555")) - assert {:error, _} = Phone.parse(unquote("#{code}555")) + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}555")) + assert {:error, _} = Phone.parse(unquote("#{code}555")) - refute unquote(main_module).match?(unquote("#{code}555")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) + refute unquote(main_module).match?(unquote("#{code}555")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}555")) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}555")) end - end) + end + end) end diff --git a/test/phone/b_countries/bd_test.exs b/test/phone/b_countries/bd_test.exs index 1ff8fe4..e631cc0 100644 --- a/test/phone/b_countries/bd_test.exs +++ b/test/phone/b_countries/bd_test.exs @@ -3,27 +3,26 @@ defmodule Phone.BDTest do main_module = Phone.BD - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} parses area code #{code}" do - assert Phone.valid?(unquote("#{code}5555555555")) - assert {:ok, parsed} = Phone.parse(unquote("#{code}5555555555")) + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} parses area code #{code}" do + assert Phone.valid?(unquote("#{code}5555555555")) + assert {:ok, parsed} = Phone.parse(unquote("#{code}5555555555")) - assert parsed.country == unquote(main_module).country - assert parsed.a2 == unquote(main_module).a2 - assert parsed.a3 == unquote(main_module).a3 - end + assert parsed.country == unquote(main_module).country + assert parsed.a2 == unquote(main_module).a2 + assert parsed.a3 == unquote(main_module).a3 + end - test "#{inspect main_module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}555")) - assert {:error, _} = Phone.parse(unquote("#{code}555")) + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}555")) + assert {:error, _} = Phone.parse(unquote("#{code}555")) - refute unquote(main_module).match?(unquote("#{code}555")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) + refute unquote(main_module).match?(unquote("#{code}555")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}555")) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}555")) end - end) + end + end) end diff --git a/test/phone/b_countries/be_test.exs b/test/phone/b_countries/be_test.exs index 4694269..0ebf1cf 100644 --- a/test/phone/b_countries/be_test.exs +++ b/test/phone/b_countries/be_test.exs @@ -3,27 +3,26 @@ defmodule Phone.BETest do main_module = Phone.BE - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} parses area code #{code}" do - assert Phone.valid?(unquote("#{code}555555555")) - assert {:ok, parsed} = Phone.parse(unquote("#{code}555555555")) + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} parses area code #{code}" do + assert Phone.valid?(unquote("#{code}555555555")) + assert {:ok, parsed} = Phone.parse(unquote("#{code}555555555")) - assert parsed.country == unquote(main_module).country - assert parsed.a2 == unquote(main_module).a2 - assert parsed.a3 == unquote(main_module).a3 - end + assert parsed.country == unquote(main_module).country + assert parsed.a2 == unquote(main_module).a2 + assert parsed.a3 == unquote(main_module).a3 + end - test "#{inspect main_module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}555")) - assert {:error, _} = Phone.parse(unquote("#{code}555")) + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}555")) + assert {:error, _} = Phone.parse(unquote("#{code}555")) - refute unquote(main_module).match?(unquote("#{code}555")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) + refute unquote(main_module).match?(unquote("#{code}555")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}555")) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}555")) end - end) + end + end) end diff --git a/test/phone/b_countries/bg_test.exs b/test/phone/b_countries/bg_test.exs index ec6c9da..3c43d8f 100644 --- a/test/phone/b_countries/bg_test.exs +++ b/test/phone/b_countries/bg_test.exs @@ -3,27 +3,26 @@ defmodule Phone.BGTest do main_module = Phone.BG - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} parses area code #{code}" do - assert Phone.valid?(unquote("#{code}555555555")) - assert {:ok, parsed} = Phone.parse(unquote("#{code}555555555")) + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} parses area code #{code}" do + assert Phone.valid?(unquote("#{code}555555555")) + assert {:ok, parsed} = Phone.parse(unquote("#{code}555555555")) - assert parsed.country == unquote(main_module).country - assert parsed.a2 == unquote(main_module).a2 - assert parsed.a3 == unquote(main_module).a3 - end + assert parsed.country == unquote(main_module).country + assert parsed.a2 == unquote(main_module).a2 + assert parsed.a3 == unquote(main_module).a3 + end - test "#{inspect main_module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}555")) - assert {:error, _} = Phone.parse(unquote("#{code}555")) + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}555")) + assert {:error, _} = Phone.parse(unquote("#{code}555")) - refute unquote(main_module).match?(unquote("#{code}555")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) + refute unquote(main_module).match?(unquote("#{code}555")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}555")) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}555")) end - end) + end + end) end diff --git a/test/phone/b_countries/bh_test.exs b/test/phone/b_countries/bh_test.exs index db2afc2..81444ff 100644 --- a/test/phone/b_countries/bh_test.exs +++ b/test/phone/b_countries/bh_test.exs @@ -3,27 +3,26 @@ defmodule Phone.BHTest do main_module = Phone.BH - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} parses area code #{code}" do - assert Phone.valid?(unquote("#{code}55555555")) - assert {:ok, parsed} = Phone.parse(unquote("#{code}55555555")) + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} parses area code #{code}" do + assert Phone.valid?(unquote("#{code}55555555")) + assert {:ok, parsed} = Phone.parse(unquote("#{code}55555555")) - assert parsed.country == unquote(main_module).country - assert parsed.a2 == unquote(main_module).a2 - assert parsed.a3 == unquote(main_module).a3 - end + assert parsed.country == unquote(main_module).country + assert parsed.a2 == unquote(main_module).a2 + assert parsed.a3 == unquote(main_module).a3 + end - test "#{inspect main_module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}555")) - assert {:error, _} = Phone.parse(unquote("#{code}555")) + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}555")) + assert {:error, _} = Phone.parse(unquote("#{code}555")) - refute unquote(main_module).match?(unquote("#{code}555")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) + refute unquote(main_module).match?(unquote("#{code}555")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}555")) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}555")) end - end) + end + end) end diff --git a/test/phone/b_countries/bi_test.exs b/test/phone/b_countries/bi_test.exs index 62a8451..f93a781 100644 --- a/test/phone/b_countries/bi_test.exs +++ b/test/phone/b_countries/bi_test.exs @@ -3,27 +3,26 @@ defmodule Phone.BITest do main_module = Phone.BI - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} parses area code #{code}" do - assert Phone.valid?(unquote("#{code}55555555")) - assert {:ok, parsed} = Phone.parse(unquote("#{code}55555555")) + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} parses area code #{code}" do + assert Phone.valid?(unquote("#{code}55555555")) + assert {:ok, parsed} = Phone.parse(unquote("#{code}55555555")) - assert parsed.country == unquote(main_module).country - assert parsed.a2 == unquote(main_module).a2 - assert parsed.a3 == unquote(main_module).a3 - end + assert parsed.country == unquote(main_module).country + assert parsed.a2 == unquote(main_module).a2 + assert parsed.a3 == unquote(main_module).a3 + end - test "#{inspect main_module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}555")) - assert {:error, _} = Phone.parse(unquote("#{code}555")) + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}555")) + assert {:error, _} = Phone.parse(unquote("#{code}555")) - refute unquote(main_module).match?(unquote("#{code}555")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) + refute unquote(main_module).match?(unquote("#{code}555")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}555")) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}555")) end - end) + end + end) end diff --git a/test/phone/b_countries/bj_test.exs b/test/phone/b_countries/bj_test.exs index 33014a6..cfb9606 100644 --- a/test/phone/b_countries/bj_test.exs +++ b/test/phone/b_countries/bj_test.exs @@ -3,27 +3,26 @@ defmodule Phone.BJTest do main_module = Phone.BJ - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} parses area code #{code}" do - assert Phone.valid?(unquote("#{code}55555555")) - assert {:ok, parsed} = Phone.parse(unquote("#{code}55555555")) + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} parses area code #{code}" do + assert Phone.valid?(unquote("#{code}55555555")) + assert {:ok, parsed} = Phone.parse(unquote("#{code}55555555")) - assert parsed.country == unquote(main_module).country - assert parsed.a2 == unquote(main_module).a2 - assert parsed.a3 == unquote(main_module).a3 - end + assert parsed.country == unquote(main_module).country + assert parsed.a2 == unquote(main_module).a2 + assert parsed.a3 == unquote(main_module).a3 + end - test "#{inspect main_module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}555")) - assert {:error, _} = Phone.parse(unquote("#{code}555")) + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}555")) + assert {:error, _} = Phone.parse(unquote("#{code}555")) - refute unquote(main_module).match?(unquote("#{code}555")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) + refute unquote(main_module).match?(unquote("#{code}555")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}555")) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}555")) end - end) + end + end) end diff --git a/test/phone/b_countries/bn_test.exs b/test/phone/b_countries/bn_test.exs index f126749..3c9fe3b 100644 --- a/test/phone/b_countries/bn_test.exs +++ b/test/phone/b_countries/bn_test.exs @@ -3,27 +3,26 @@ defmodule Phone.BNTest do main_module = Phone.BN - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} parses area code #{code}" do - assert Phone.valid?(unquote("#{code}5555555")) - assert {:ok, parsed} = Phone.parse(unquote("#{code}5555555")) + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} parses area code #{code}" do + assert Phone.valid?(unquote("#{code}5555555")) + assert {:ok, parsed} = Phone.parse(unquote("#{code}5555555")) - assert parsed.country == unquote(main_module).country - assert parsed.a2 == unquote(main_module).a2 - assert parsed.a3 == unquote(main_module).a3 - end + assert parsed.country == unquote(main_module).country + assert parsed.a2 == unquote(main_module).a2 + assert parsed.a3 == unquote(main_module).a3 + end - test "#{inspect main_module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}555")) - assert {:error, _} = Phone.parse(unquote("#{code}555")) + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}555")) + assert {:error, _} = Phone.parse(unquote("#{code}555")) - refute unquote(main_module).match?(unquote("#{code}555")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) + refute unquote(main_module).match?(unquote("#{code}555")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}555")) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}555")) end - end) + end + end) end diff --git a/test/phone/b_countries/bo_test.exs b/test/phone/b_countries/bo_test.exs index 9b552e5..28001ea 100644 --- a/test/phone/b_countries/bo_test.exs +++ b/test/phone/b_countries/bo_test.exs @@ -3,27 +3,26 @@ defmodule Phone.BOTest do main_module = Phone.BO - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} parses area code #{code}" do - assert Phone.valid?(unquote("#{code}55555555")) - assert {:ok, parsed} = Phone.parse(unquote("#{code}55555555")) + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} parses area code #{code}" do + assert Phone.valid?(unquote("#{code}55555555")) + assert {:ok, parsed} = Phone.parse(unquote("#{code}55555555")) - assert parsed.country == unquote(main_module).country - assert parsed.a2 == unquote(main_module).a2 - assert parsed.a3 == unquote(main_module).a3 - end + assert parsed.country == unquote(main_module).country + assert parsed.a2 == unquote(main_module).a2 + assert parsed.a3 == unquote(main_module).a3 + end - test "#{inspect main_module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}555")) - assert {:error, _} = Phone.parse(unquote("#{code}555")) + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}555")) + assert {:error, _} = Phone.parse(unquote("#{code}555")) - refute unquote(main_module).match?(unquote("#{code}555")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) + refute unquote(main_module).match?(unquote("#{code}555")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}555")) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}555")) end - end) + end + end) end diff --git a/test/phone/b_countries/br_test.exs b/test/phone/b_countries/br_test.exs index 21c5eaf..5e3ebf8 100644 --- a/test/phone/b_countries/br_test.exs +++ b/test/phone/b_countries/br_test.exs @@ -4,65 +4,83 @@ defmodule Phone.BRTest do main_module = Phone.BR all_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 + 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 ] - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} parses area code #{code}" do + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} parses area code #{code}" do + assert Phone.valid?(unquote("#{code}55555555")) + assert {:ok, parsed} = Phone.parse(unquote("#{code}55555555")) + + assert parsed.country == unquote(main_module).country + assert parsed.a2 == unquote(main_module).a2 + assert parsed.a3 == unquote(main_module).a3 + end + + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}5555555")) + assert {:error, _} = Phone.parse(unquote("#{code}555555")) + + refute unquote(main_module).match?(unquote("#{code}5555555")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}555555")) + + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}555555")) + end + end + end) + + Enum.map(all_modules, fn module -> + Enum.map(module.codes, fn code -> + test "#{inspect(module)} parses area code #{code}" do assert Phone.valid?(unquote("#{code}55555555")) assert {:ok, parsed} = Phone.parse(unquote("#{code}55555555")) assert parsed.country == unquote(main_module).country assert parsed.a2 == unquote(main_module).a2 assert parsed.a3 == unquote(main_module).a3 + assert parsed.area_type == unquote(module).area_type + assert parsed.area_name == unquote(module).area_name + assert parsed.area_abbreviation == unquote(module).area_abbreviation end - test "#{inspect main_module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}5555555")) + test "#{inspect(module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}555555")) assert {:error, _} = Phone.parse(unquote("#{code}555555")) - refute unquote(main_module).match?(unquote("#{code}5555555")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}555555")) + refute unquote(module).match?(unquote("#{code}555555")) + assert {:error, _} = unquote(module).build(unquote("#{code}555555")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}555555")) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(module).build!(unquote("#{code}555555")) + end end end) - - Enum.map(all_modules, - fn module -> - Enum.map(module.codes, - fn code -> - test "#{inspect module} parses area code #{code}" do - assert Phone.valid?(unquote("#{code}55555555")) - assert {:ok, parsed} = Phone.parse(unquote("#{code}55555555")) - - assert parsed.country == unquote(main_module).country - assert parsed.a2 == unquote(main_module).a2 - assert parsed.a3 == unquote(main_module).a3 - assert parsed.area_type == unquote(module).area_type - assert parsed.area_name == unquote(module).area_name - assert parsed.area_abbreviation == unquote(module).area_abbreviation - end - - test "#{inspect module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}555555")) - assert {:error, _} = Phone.parse(unquote("#{code}555555")) - - refute unquote(module).match?(unquote("#{code}555555")) - assert {:error, _} = unquote(module).build(unquote("#{code}555555")) - - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(module).build!(unquote("#{code}555555")) end - end - end) - end) + end) end diff --git a/test/phone/b_countries/bt_test.exs b/test/phone/b_countries/bt_test.exs index ac0f79c..c18bbd6 100644 --- a/test/phone/b_countries/bt_test.exs +++ b/test/phone/b_countries/bt_test.exs @@ -3,27 +3,26 @@ defmodule Phone.BTTest do main_module = Phone.BT - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} parses area code #{code}" do - assert Phone.valid?(unquote("#{code}55555555")) - assert {:ok, parsed} = Phone.parse(unquote("#{code}55555555")) + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} parses area code #{code}" do + assert Phone.valid?(unquote("#{code}55555555")) + assert {:ok, parsed} = Phone.parse(unquote("#{code}55555555")) - assert parsed.country == unquote(main_module).country - assert parsed.a2 == unquote(main_module).a2 - assert parsed.a3 == unquote(main_module).a3 - end + assert parsed.country == unquote(main_module).country + assert parsed.a2 == unquote(main_module).a2 + assert parsed.a3 == unquote(main_module).a3 + end - test "#{inspect main_module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}555")) - assert {:error, _} = Phone.parse(unquote("#{code}555")) + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}555")) + assert {:error, _} = Phone.parse(unquote("#{code}555")) - refute unquote(main_module).match?(unquote("#{code}555")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) + refute unquote(main_module).match?(unquote("#{code}555")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}555")) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}555")) end - end) + end + end) end diff --git a/test/phone/b_countries/bw_test.exs b/test/phone/b_countries/bw_test.exs index 76b9c2f..2b97a68 100644 --- a/test/phone/b_countries/bw_test.exs +++ b/test/phone/b_countries/bw_test.exs @@ -3,27 +3,26 @@ defmodule Phone.BWTest do main_module = Phone.BW - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} parses area code #{code}" do - assert Phone.valid?(unquote("#{code}5555555")) - assert {:ok, parsed} = Phone.parse(unquote("#{code}5555555")) + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} parses area code #{code}" do + assert Phone.valid?(unquote("#{code}5555555")) + assert {:ok, parsed} = Phone.parse(unquote("#{code}5555555")) - assert parsed.country == unquote(main_module).country - assert parsed.a2 == unquote(main_module).a2 - assert parsed.a3 == unquote(main_module).a3 - end + assert parsed.country == unquote(main_module).country + assert parsed.a2 == unquote(main_module).a2 + assert parsed.a3 == unquote(main_module).a3 + end - test "#{inspect main_module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}555")) - assert {:error, _} = Phone.parse(unquote("#{code}555")) + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}555")) + assert {:error, _} = Phone.parse(unquote("#{code}555")) - refute unquote(main_module).match?(unquote("#{code}555")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) + refute unquote(main_module).match?(unquote("#{code}555")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}555")) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}555")) end - end) + end + end) end diff --git a/test/phone/b_countries/by_test.exs b/test/phone/b_countries/by_test.exs index 1563aea..dc50181 100644 --- a/test/phone/b_countries/by_test.exs +++ b/test/phone/b_countries/by_test.exs @@ -3,27 +3,26 @@ defmodule Phone.BYTest do main_module = Phone.BY - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} parses area code #{code}" do - assert Phone.valid?(unquote("#{code}555555555")) - assert {:ok, parsed} = Phone.parse(unquote("#{code}555555555")) + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} parses area code #{code}" do + assert Phone.valid?(unquote("#{code}555555555")) + assert {:ok, parsed} = Phone.parse(unquote("#{code}555555555")) - assert parsed.country == unquote(main_module).country - assert parsed.a2 == unquote(main_module).a2 - assert parsed.a3 == unquote(main_module).a3 - end + assert parsed.country == unquote(main_module).country + assert parsed.a2 == unquote(main_module).a2 + assert parsed.a3 == unquote(main_module).a3 + end - test "#{inspect main_module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}555")) - assert {:error, _} = Phone.parse(unquote("#{code}555")) + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}555")) + assert {:error, _} = Phone.parse(unquote("#{code}555")) - refute unquote(main_module).match?(unquote("#{code}555")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) + refute unquote(main_module).match?(unquote("#{code}555")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}555")) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}555")) end - end) + end + end) end diff --git a/test/phone/b_countries/bz_test.exs b/test/phone/b_countries/bz_test.exs index 44421d2..a5b4575 100644 --- a/test/phone/b_countries/bz_test.exs +++ b/test/phone/b_countries/bz_test.exs @@ -3,35 +3,34 @@ defmodule Phone.BZTest do main_module = Phone.BZ - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} parses area code #{code}" do - assert Phone.valid?(unquote("#{code}5555555")) - assert {:ok, parsed} = Phone.parse(unquote("#{code}5555555")) - - assert unquote(main_module).match?(unquote("#{code}5555555")) - assert {:ok, parsed2} = unquote(main_module).build(unquote("#{code}5555555")) - - assert parsed.country == unquote(main_module).country - assert parsed.a2 == unquote(main_module).a2 - assert parsed.a3 == unquote(main_module).a3 - assert parsed == parsed2 - end + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} parses area code #{code}" do + assert Phone.valid?(unquote("#{code}5555555")) + assert {:ok, parsed} = Phone.parse(unquote("#{code}5555555")) + + assert unquote(main_module).match?(unquote("#{code}5555555")) + assert {:ok, parsed2} = unquote(main_module).build(unquote("#{code}5555555")) - test "#{inspect main_module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}555")) - assert {:error, _} = Phone.parse(unquote("#{code}555")) + assert parsed.country == unquote(main_module).country + assert parsed.a2 == unquote(main_module).a2 + assert parsed.a3 == unquote(main_module).a3 + assert parsed == parsed2 + end - refute unquote(main_module).match?(unquote("#{code}555")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}555")) + assert {:error, _} = Phone.parse(unquote("#{code}555")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}555")) end + refute unquote(main_module).match?(unquote("#{code}555")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}555")) + + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}555")) + end - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> Phone.parse!(unquote("#{code}555")) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> + Phone.parse!(unquote("#{code}555")) end - end) + end + end) end diff --git a/test/phone/c_countries/ca_test.exs b/test/phone/c_countries/ca_test.exs index fd0f35e..cbe43a4 100644 --- a/test/phone/c_countries/ca_test.exs +++ b/test/phone/c_countries/ca_test.exs @@ -4,63 +4,66 @@ defmodule Phone.CATest do main_module = Phone.NANP.CA all_modules = [ - Phone.NANP.CA.AB, Phone.NANP.CA.BC, Phone.NANP.CA.MB, - Phone.NANP.CA.NB, Phone.NANP.CA.NL, Phone.NANP.CA.NSAndPE, - Phone.NANP.CA.ON, Phone.NANP.CA.QC, Phone.NANP.CA.SK, + Phone.NANP.CA.AB, + Phone.NANP.CA.BC, + Phone.NANP.CA.MB, + Phone.NANP.CA.NB, + Phone.NANP.CA.NL, + Phone.NANP.CA.NSAndPE, + Phone.NANP.CA.ON, + Phone.NANP.CA.QC, + Phone.NANP.CA.SK, Phone.NANP.CA.Territory ] - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} parses area code #{code}" do + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} parses area code #{code}" do + assert Phone.valid?(unquote("#{code}5551234")) + assert {:ok, parsed} = Phone.parse(unquote("#{code}5551234")) + + assert parsed.country == unquote(main_module).country + assert parsed.a2 == unquote(main_module).a2 + assert parsed.a3 == unquote(main_module).a3 + end + + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}555123")) + assert {:error, _} = Phone.parse(unquote("#{code}555123")) + + refute unquote(main_module).match?(unquote("#{code}555123")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}555123")) + + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}555123")) + end + end + end) + + Enum.map(all_modules, fn module -> + Enum.map(module.codes, fn code -> + test "#{inspect(module)} parses area code #{code}" do assert Phone.valid?(unquote("#{code}5551234")) assert {:ok, parsed} = Phone.parse(unquote("#{code}5551234")) assert parsed.country == unquote(main_module).country assert parsed.a2 == unquote(main_module).a2 assert parsed.a3 == unquote(main_module).a3 + assert parsed.area_type == unquote(module).area_type + assert parsed.area_name == unquote(module).area_name + assert parsed.area_abbreviation == unquote(module).area_abbreviation end - test "#{inspect main_module} cant parse wrong number with code #{code}" do + test "#{inspect(module)} cant parse wrong number with code #{code}" do refute Phone.valid?(unquote("#{code}555123")) assert {:error, _} = Phone.parse(unquote("#{code}555123")) - refute unquote(main_module).match?(unquote("#{code}555123")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}555123")) + refute unquote(module).match?(unquote("#{code}555123")) + assert {:error, _} = unquote(module).build(unquote("#{code}555123")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}555123")) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(module).build!(unquote("#{code}555123")) + end end end) - - Enum.map(all_modules, - fn module -> - Enum.map(module.codes, - fn code -> - test "#{inspect module} parses area code #{code}" do - assert Phone.valid?(unquote("#{code}5551234")) - assert {:ok, parsed} = Phone.parse(unquote("#{code}5551234")) - - assert parsed.country == unquote(main_module).country - assert parsed.a2 == unquote(main_module).a2 - assert parsed.a3 == unquote(main_module).a3 - assert parsed.area_type == unquote(module).area_type - assert parsed.area_name == unquote(module).area_name - assert parsed.area_abbreviation == unquote(module).area_abbreviation - end - - test "#{inspect module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}555123")) - assert {:error, _} = Phone.parse(unquote("#{code}555123")) - - refute unquote(module).match?(unquote("#{code}555123")) - assert {:error, _} = unquote(module).build(unquote("#{code}555123")) - - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(module).build!(unquote("#{code}555123")) end - end - end) - end) + end) end diff --git a/test/phone/countries_test.exs b/test/phone/countries_test.exs index 8ef708d..ad1eeb4 100644 --- a/test/phone/countries_test.exs +++ b/test/phone/countries_test.exs @@ -2,71 +2,237 @@ defmodule Phone.CountriesTest do use ExUnit.Case, async: true main_module = Phone.Countries - all_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, - Phone.BN, Phone.BO, Phone.BR, Phone.BT, Phone.BW, Phone.BY, - Phone.BZ, Phone.CD, Phone.CF, Phone.CG, Phone.CH, Phone.CI, - Phone.CK, Phone.CL, Phone.CM, Phone.CN, Phone.CO, Phone.CR, - Phone.CU, Phone.CV, Phone.CW, Phone.CY, Phone.CZ, Phone.DE, - Phone.DJ, Phone.DK, Phone.DZ, Phone.EC, Phone.EE, Phone.EG, - Phone.ER, Phone.ES, Phone.ET, Phone.FI, Phone.FJ, Phone.FM, - Phone.FO, Phone.FR, Phone.GA, Phone.GB, Phone.GE, Phone.GF, - Phone.GH, Phone.GI, Phone.GL, Phone.GM, Phone.GN, Phone.GQ, - Phone.GR, Phone.GT, Phone.GW, Phone.GY, Phone.HK, Phone.HN, - Phone.HR, Phone.HT, Phone.HU, Phone.ID, Phone.IE, Phone.IL, - Phone.IN, Phone.IO, Phone.IQ, Phone.IR, Phone.IS, Phone.IT, - Phone.JO, Phone.JP, Phone.KE, Phone.KG, Phone.KH, Phone.KI, - Phone.KM, Phone.KP, Phone.KR, Phone.KW, Phone.KZ, Phone.LA, - Phone.LB, Phone.LI, Phone.LK, Phone.LR, Phone.LS, Phone.LT, - Phone.LU, Phone.LV, Phone.LY, Phone.MA, Phone.MC, Phone.MD, - Phone.ME, Phone.MG, Phone.MH, Phone.MK, Phone.ML, Phone.MM, - Phone.MN, Phone.MO, Phone.MQ, Phone.MR, Phone.MT, Phone.MU, - Phone.MV, Phone.MW, Phone.MX, Phone.MY, Phone.MZ, Phone.NA, - Phone.NC, Phone.NE, Phone.NG, Phone.NI, Phone.NL, Phone.NO, - Phone.NP, Phone.NR, Phone.NU, Phone.NZ, Phone.OM, Phone.PA, - Phone.PE, Phone.PF, Phone.PG, Phone.PH, Phone.PK, Phone.PL, - Phone.PM, Phone.PS, Phone.PT, Phone.PW, Phone.PY, Phone.QA, - Phone.RO, Phone.RS, Phone.RU, Phone.RW, Phone.SA, Phone.SB, - Phone.SC, Phone.SD, Phone.SE, Phone.SG, Phone.SH, Phone.SI, - Phone.SK, Phone.SL, Phone.SM, Phone.SN, Phone.SO, Phone.SR, - Phone.SS, Phone.ST, Phone.SV, Phone.SY, Phone.SZ, Phone.TD, - Phone.TG, Phone.TH, Phone.TJ, Phone.TK, Phone.TL, Phone.TM, - Phone.TN, Phone.TO, Phone.TR, Phone.TV, Phone.TW, Phone.TZ, - Phone.UA, Phone.UG, Phone.UY, Phone.UZ, Phone.VE, Phone.VN, - Phone.VU, Phone.WF, Phone.WS, Phone.YE, Phone.ZA, Phone.ZM, - Phone.ZW, Phone.NANP] - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}")) - assert {:error, _} = Phone.parse(unquote("#{code}")) + all_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, + Phone.BN, + Phone.BO, + Phone.BR, + Phone.BT, + Phone.BW, + Phone.BY, + Phone.BZ, + Phone.CD, + Phone.CF, + Phone.CG, + Phone.CH, + Phone.CI, + Phone.CK, + Phone.CL, + Phone.CM, + Phone.CN, + Phone.CO, + Phone.CR, + Phone.CU, + Phone.CV, + Phone.CW, + Phone.CY, + Phone.CZ, + Phone.DE, + Phone.DJ, + Phone.DK, + Phone.DZ, + Phone.EC, + Phone.EE, + Phone.EG, + Phone.ER, + Phone.ES, + Phone.ET, + Phone.FI, + Phone.FJ, + Phone.FM, + Phone.FO, + Phone.FR, + Phone.GA, + Phone.GB, + Phone.GE, + Phone.GF, + Phone.GH, + Phone.GI, + Phone.GL, + Phone.GM, + Phone.GN, + Phone.GQ, + Phone.GR, + Phone.GT, + Phone.GW, + Phone.GY, + Phone.HK, + Phone.HN, + Phone.HR, + Phone.HT, + Phone.HU, + Phone.ID, + Phone.IE, + Phone.IL, + Phone.IN, + Phone.IO, + Phone.IQ, + Phone.IR, + Phone.IS, + Phone.IT, + Phone.JO, + Phone.JP, + Phone.KE, + Phone.KG, + Phone.KH, + Phone.KI, + Phone.KM, + Phone.KP, + Phone.KR, + Phone.KW, + Phone.KZ, + Phone.LA, + Phone.LB, + Phone.LI, + Phone.LK, + Phone.LR, + Phone.LS, + Phone.LT, + Phone.LU, + Phone.LV, + Phone.LY, + Phone.MA, + Phone.MC, + Phone.MD, + Phone.ME, + Phone.MG, + Phone.MH, + Phone.MK, + Phone.ML, + Phone.MM, + Phone.MN, + Phone.MO, + Phone.MQ, + Phone.MR, + Phone.MT, + Phone.MU, + Phone.MV, + Phone.MW, + Phone.MX, + Phone.MY, + Phone.MZ, + Phone.NA, + Phone.NC, + Phone.NE, + Phone.NG, + Phone.NI, + Phone.NL, + Phone.NO, + Phone.NP, + Phone.NR, + Phone.NU, + Phone.NZ, + Phone.OM, + Phone.PA, + Phone.PE, + Phone.PF, + Phone.PG, + Phone.PH, + Phone.PK, + Phone.PL, + Phone.PM, + Phone.PS, + Phone.PT, + Phone.PW, + Phone.PY, + Phone.QA, + Phone.RO, + Phone.RS, + Phone.RU, + Phone.RW, + Phone.SA, + Phone.SB, + Phone.SC, + Phone.SD, + Phone.SE, + Phone.SG, + Phone.SH, + Phone.SI, + Phone.SK, + Phone.SL, + Phone.SM, + Phone.SN, + Phone.SO, + Phone.SR, + Phone.SS, + Phone.ST, + Phone.SV, + Phone.SY, + Phone.SZ, + Phone.TD, + Phone.TG, + Phone.TH, + Phone.TJ, + Phone.TK, + Phone.TL, + Phone.TM, + Phone.TN, + Phone.TO, + Phone.TR, + Phone.TV, + Phone.TW, + Phone.TZ, + Phone.UA, + Phone.UG, + Phone.UY, + Phone.UZ, + Phone.VE, + Phone.VN, + Phone.VU, + Phone.WF, + Phone.WS, + Phone.YE, + Phone.ZA, + Phone.ZM, + Phone.ZW, + Phone.NANP + ] - refute unquote(main_module).match?(unquote("#{code}")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}")) + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}")) + assert {:error, _} = Phone.parse(unquote("#{code}")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}")) end + refute unquote(main_module).match?(unquote("#{code}")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}")) + + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}")) end - end) + end + end) - Enum.map(all_modules, - fn module -> - Enum.map(module.codes, - fn code -> - test "#{inspect module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}")) - assert {:error, _} = Phone.parse(unquote("#{code}")) + Enum.map(all_modules, fn module -> + Enum.map(module.codes, fn code -> + test "#{inspect(module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}")) + assert {:error, _} = Phone.parse(unquote("#{code}")) - refute unquote(module).match?(unquote("#{code}")) - assert {:error, _} = unquote(module).build(unquote("#{code}")) + refute unquote(module).match?(unquote("#{code}")) + assert {:error, _} = unquote(module).build(unquote("#{code}")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(module).build!(unquote("#{code}")) end - end - end) + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(module).build!(unquote("#{code}")) + end + end end) + end) end diff --git a/test/phone/nanp_test.exs b/test/phone/nanp_test.exs index 21af2df..814be54 100644 --- a/test/phone/nanp_test.exs +++ b/test/phone/nanp_test.exs @@ -2,55 +2,72 @@ defmodule Phone.NANPTest do use ExUnit.Case, async: true main_module = Phone.NANP + all_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 + 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 ] - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} cant parse wrong number with code #{code}" do + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}555123")) + assert {:error, _} = Phone.parse(unquote("#{code}555123")) + + refute unquote(main_module).match?(unquote("#{code}555123")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}555123")) + + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}555123")) + end + end + end) + + Enum.map(all_modules, fn module -> + Enum.map(module.codes, fn code -> + test "#{inspect(module)} parses area code #{code}" do + assert Phone.valid?(unquote("#{code}5551234")) + assert {:ok, parsed} = Phone.parse(unquote("#{code}5551234")) + + assert parsed.country == unquote(module).country + assert parsed.a2 == unquote(module).a2 + assert parsed.a3 == unquote(module).a3 + end + + test "#{inspect(module)} cant parse wrong number with code #{code}" do refute Phone.valid?(unquote("#{code}555123")) assert {:error, _} = Phone.parse(unquote("#{code}555123")) - refute unquote(main_module).match?(unquote("#{code}555123")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}555123")) + refute unquote(module).match?(unquote("#{code}555123")) + assert {:error, _} = unquote(module).build(unquote("#{code}555123")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}555123")) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(module).build!(unquote("#{code}555123")) + end end end) - - Enum.map(all_modules, - fn module -> - Enum.map(module.codes, - fn code -> - test "#{inspect module} parses area code #{code}" do - assert Phone.valid?(unquote("#{code}5551234")) - assert {:ok, parsed} = Phone.parse(unquote("#{code}5551234")) - - assert parsed.country == unquote(module).country - assert parsed.a2 == unquote(module).a2 - assert parsed.a3 == unquote(module).a3 - end - - test "#{inspect module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}555123")) - assert {:error, _} = Phone.parse(unquote("#{code}555123")) - - refute unquote(module).match?(unquote("#{code}555123")) - assert {:error, _} = unquote(module).build(unquote("#{code}555123")) - - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(module).build!(unquote("#{code}555123")) end - end - end) - end) + end) end diff --git a/test/phone/u_countries/us_test.exs b/test/phone/u_countries/us_test.exs index 3eca5d0..0bc32ea 100644 --- a/test/phone/u_countries/us_test.exs +++ b/test/phone/u_countries/us_test.exs @@ -3,71 +3,108 @@ defmodule Phone.USTest do main_module = Phone.NANP.US - all_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] + all_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 + ] - Enum.map(main_module.codes, - fn code -> - test "#{inspect main_module} parses area code #{code}" do + Enum.map(main_module.codes, fn code -> + test "#{inspect(main_module)} parses area code #{code}" do + assert Phone.valid?(unquote("#{code}5551234")) + assert {:ok, parsed} = Phone.parse(unquote("#{code}5551234")) + + assert parsed.country == unquote(main_module).country + assert parsed.a2 == unquote(main_module).a2 + assert parsed.a3 == unquote(main_module).a3 + end + + test "#{inspect(main_module)} cant parse wrong number with code #{code}" do + refute Phone.valid?(unquote("#{code}555123")) + assert {:error, _} = Phone.parse(unquote("#{code}555123")) + + refute unquote(main_module).match?(unquote("#{code}555123")) + assert {:error, _} = unquote(main_module).build(unquote("#{code}555123")) + + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(main_module).build!(unquote("#{code}555123")) + end + end + end) + + Enum.map(all_modules, fn module -> + Enum.map(module.codes, fn code -> + test "#{inspect(module)} parses area code #{code}" do assert Phone.valid?(unquote("#{code}5551234")) assert {:ok, parsed} = Phone.parse(unquote("#{code}5551234")) assert parsed.country == unquote(main_module).country assert parsed.a2 == unquote(main_module).a2 assert parsed.a3 == unquote(main_module).a3 + assert parsed.area_type == unquote(module).area_type + assert parsed.area_name == unquote(module).area_name + assert parsed.area_abbreviation == unquote(module).area_abbreviation end - test "#{inspect main_module} cant parse wrong number with code #{code}" do + test "#{inspect(module)} cant parse wrong number with code #{code}" do refute Phone.valid?(unquote("#{code}555123")) assert {:error, _} = Phone.parse(unquote("#{code}555123")) - refute unquote(main_module).match?(unquote("#{code}555123")) - assert {:error, _} = unquote(main_module).build(unquote("#{code}555123")) + refute unquote(module).match?(unquote("#{code}555123")) + assert {:error, _} = unquote(module).build(unquote("#{code}555123")) - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(main_module).build!(unquote("#{code}555123")) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> + unquote(module).build!(unquote("#{code}555123")) + end end end) - - Enum.map(all_modules, - fn module -> - Enum.map(module.codes, - fn code -> - test "#{inspect module} parses area code #{code}" do - assert Phone.valid?(unquote("#{code}5551234")) - assert {:ok, parsed} = Phone.parse(unquote("#{code}5551234")) - - assert parsed.country == unquote(main_module).country - assert parsed.a2 == unquote(main_module).a2 - assert parsed.a3 == unquote(main_module).a3 - assert parsed.area_type == unquote(module).area_type - assert parsed.area_name == unquote(module).area_name - assert parsed.area_abbreviation == unquote(module).area_abbreviation - end - - test "#{inspect module} cant parse wrong number with code #{code}" do - refute Phone.valid?(unquote("#{code}555123")) - assert {:error, _} = Phone.parse(unquote("#{code}555123")) - - refute unquote(module).match?(unquote("#{code}555123")) - assert {:error, _} = unquote(module).build(unquote("#{code}555123")) - - assert_raise ArgumentError, - "Not a valid phone number.", - fn -> unquote(module).build!(unquote("#{code}555123")) end - end - end) - end) + end) end diff --git a/test/phone_test.exs b/test/phone_test.exs index 5966096..f9bd40f 100644 --- a/test/phone_test.exs +++ b/test/phone_test.exs @@ -1,14 +1,16 @@ defmodule PhoneTest do use ExUnit.Case, async: true doctest Phone - @right_assertion {:ok, %{ - a2: "HR", - a3: "HRV", - country: "Croatia", - international_code: "385", - area_code: "", - number: "12345678" - }} + + @right_assertion {:ok, + %{ + a2: "HR", + a3: "HRV", + country: "Croatia", + international_code: "385", + area_code: "", + number: "12345678" + }} @right_return %{ a2: "HR", a3: "HRV", @@ -27,20 +29,20 @@ defmodule PhoneTest do test "parse not valid integer" do assert Phone.parse(5532) == @wrong_assertion - assert_raise ArgumentError, - "Not a valid phone number.", fn -> Phone.parse!(5532) end + assert_raise ArgumentError, "Not a valid phone number.", fn -> Phone.parse!(5532) end end test "parse string with letters" do assert Phone.parse("abc") == @wrong_assertion - assert_raise ArgumentError, - "Not a valid phone number.", fn -> Phone.parse!("abc") end + assert_raise ArgumentError, "Not a valid phone number.", fn -> Phone.parse!("abc") end end test "parse string with numbers and letters" do assert Phone.parse("555112345678abc") == @wrong_assertion - assert_raise ArgumentError, - "Not a valid phone number.", fn -> Phone.parse!("555112345678abc") end + + assert_raise ArgumentError, "Not a valid phone number.", fn -> + Phone.parse!("555112345678abc") + end end test "parse string with formatted number" do @@ -56,23 +58,27 @@ defmodule PhoneTest do test "parse other types" do assert Phone.parse(:test) == @wrong_type - assert_raise ArgumentError, - "Not a valid parameter, only string or integer.", - fn -> Phone.parse!(:test) end + + assert_raise ArgumentError, "Not a valid parameter, only string or integer.", fn -> + Phone.parse!(:test) + end assert Phone.parse({55, 51, 1234, 5678}) == @wrong_type - assert_raise ArgumentError, - "Not a valid parameter, only string or integer.", - fn -> Phone.parse!({55, 51, 1234, 5678}) end + + assert_raise ArgumentError, "Not a valid parameter, only string or integer.", fn -> + Phone.parse!({55, 51, 1234, 5678}) + end assert Phone.parse([55, 51, 1234, 5678]) == @wrong_type - assert_raise ArgumentError, - "Not a valid parameter, only string or integer.", - fn -> Phone.parse!([55, 51, 1234, 5678]) end - - assert Phone.parse(fn(t) -> t end) == @wrong_type - assert_raise ArgumentError, - "Not a valid parameter, only string or integer.", - fn -> Phone.parse!(fn(t) -> t end) end + + assert_raise ArgumentError, "Not a valid parameter, only string or integer.", fn -> + Phone.parse!([55, 51, 1234, 5678]) + end + + assert Phone.parse(fn t -> t end) == @wrong_type + + assert_raise ArgumentError, "Not a valid parameter, only string or integer.", fn -> + Phone.parse!(fn t -> t end) + end end end From 2e82a5c79b16dd3cb7e99ccd4c5c1cc1b111e997 Mon Sep 17 00:00:00 2001 From: Flavio Date: Sat, 24 Mar 2018 14:40:09 -0300 Subject: [PATCH 2/3] Correct NANP Toll Free number typo --- lib/phone/nanp/toll_free.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/phone/nanp/toll_free.ex b/lib/phone/nanp/toll_free.ex index a1fc213..62c3514 100644 --- a/lib/phone/nanp/toll_free.ex +++ b/lib/phone/nanp/toll_free.ex @@ -4,7 +4,7 @@ defmodule Phone.NANP.TollFree do use Helper.Country def regex, do: ~r/^(1)(800|833|844|855|866|877|888)([2-9].{6})$/ - def country, do: "NANP tool-free" + def country, do: "NANP toll-free" def a2, do: "" def a3, do: "" From 72906b0a6fd8ad965d5c3d6c1a41c674c6b62f6f Mon Sep 17 00:00:00 2001 From: Flavio Date: Sat, 24 Mar 2018 14:47:38 -0300 Subject: [PATCH 3/3] v0.4.3 --- .travis.yml | 4 ++-- CHANGELOG.md | 5 +++++ mix.exs | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 187b65c..0322698 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,12 @@ language: elixir elixir: - - 1.4.5 - 1.5.1 + - 1.6.4 otp_release: - 19.3 - - 20.0 + - 20.3 script: - MIX_ENV=test mix coveralls.travis --force diff --git a/CHANGELOG.md b/CHANGELOG.md index 450a14c..0b68bf9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog + +## v0.4.3: + * Add Idaho, New York, Pennsylvania, Texas, Washington missing area codes. + * Fix typo on NANP Toll Free Number module. + ## v0.4.2: * Correct parsing for Angola numbers diff --git a/mix.exs b/mix.exs index a84dd9d..b9ea433 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule Phone.Mixfile do def project do [ app: :phone, - version: "0.4.2", + version: "0.4.3", elixir: ">= 1.1.0", build_embedded: Mix.env() == :prod, start_permanent: Mix.env() == :prod, @@ -18,7 +18,7 @@ defmodule Phone.Mixfile do defp package do [ files: files(), - maintainers: ["Flávio Moreira Vieira"], + maintainers: ["Flávio M.V."], licenses: ["Apache 2.0"], links: links() ]