From a72e1d4d35507979890502f441c6a211f111dd58 Mon Sep 17 00:00:00 2001 From: Gabriel Jaldon Date: Wed, 2 Dec 2020 18:06:48 +0800 Subject: [PATCH 1/5] Support +1658 for Jamaica --- lib/helpers/parser.ex | 3 ++- lib/phone/nanp.ex | 3 ++- lib/phone/nanp/{jm.ex => jm1.ex} | 2 +- lib/phone/nanp/jm2.ex | 12 ++++++++++++ 4 files changed, 17 insertions(+), 3 deletions(-) rename lib/phone/nanp/{jm.ex => jm1.ex} (86%) create mode 100644 lib/phone/nanp/jm2.ex diff --git a/lib/helpers/parser.ex b/lib/helpers/parser.ex index a81f422..f6ac2f2 100644 --- a/lib/helpers/parser.ex +++ b/lib/helpers/parser.ex @@ -224,7 +224,8 @@ defmodule Helper.Parser do parser(:do, "1") parser(:gd, "1") parser(:gu, "1") - parser(:jm, "1") + parser(:jm1, "1") + parser(:jm2, "1") parser(:kn, "1") parser(:ky, "1") parser(:lc, "1") diff --git a/lib/phone/nanp.ex b/lib/phone/nanp.ex index 69c987b..9e6811f 100644 --- a/lib/phone/nanp.ex +++ b/lib/phone/nanp.ex @@ -15,7 +15,8 @@ defmodule Phone.NANP do Phone.NANP.DO, Phone.NANP.GD, Phone.NANP.GU, - Phone.NANP.JM, + Phone.NANP.JM1, + Phone.NANP.JM2, Phone.NANP.KN, Phone.NANP.KY, Phone.NANP.LC, diff --git a/lib/phone/nanp/jm.ex b/lib/phone/nanp/jm1.ex similarity index 86% rename from lib/phone/nanp/jm.ex rename to lib/phone/nanp/jm1.ex index 3b3dfd4..4a86c26 100644 --- a/lib/phone/nanp/jm.ex +++ b/lib/phone/nanp/jm1.ex @@ -1,4 +1,4 @@ -defmodule Phone.NANP.JM do +defmodule Phone.NANP.JM1 do @moduledoc false use Helper.Country diff --git a/lib/phone/nanp/jm2.ex b/lib/phone/nanp/jm2.ex new file mode 100644 index 0000000..edb30e8 --- /dev/null +++ b/lib/phone/nanp/jm2.ex @@ -0,0 +1,12 @@ +defmodule Phone.NANP.JM2 do + @moduledoc false + + use Helper.Country + + def regex, do: ~r/^(1)(658)([2-9].{6})$/ + def country, do: "Jamaica" + def a2, do: "JA" + def a3, do: "JAM" + + matcher(:regex, ["1658"]) +end From 020d4ac43d1b191a7b2b7ff3c15cfe8078646c7a Mon Sep 17 00:00:00 2001 From: Gabriel Jaldon Date: Wed, 2 Dec 2020 18:26:28 +0800 Subject: [PATCH 2/5] Rename to "Saint Vincent and the Grenadines" --- lib/phone/nanp/vc.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/phone/nanp/vc.ex b/lib/phone/nanp/vc.ex index eebebe3..6bcbb72 100644 --- a/lib/phone/nanp/vc.ex +++ b/lib/phone/nanp/vc.ex @@ -4,7 +4,7 @@ defmodule Phone.NANP.VC do use Helper.Country def regex, do: ~r/^(1)(784)([2-9].{6})$/ - def country, do: "Saint Vicent and the Grenadines" + def country, do: "Saint Vincent and the Grenadines" def a2, do: "VC" def a3, do: "VCT" From 1b91fca485a1fc6f919484d69fb57dbee345ccf7 Mon Sep 17 00:00:00 2001 From: Cevado Date: Tue, 29 Dec 2020 16:22:43 -0300 Subject: [PATCH 3/5] remove duplicate modules for JM --- lib/helpers/parser.ex | 3 +-- lib/phone/nanp.ex | 3 +-- lib/phone/nanp/{jm1.ex => jm.ex} | 6 +++--- lib/phone/nanp/jm2.ex | 12 ------------ 4 files changed, 5 insertions(+), 19 deletions(-) rename lib/phone/nanp/{jm1.ex => jm.ex} (51%) delete mode 100644 lib/phone/nanp/jm2.ex diff --git a/lib/helpers/parser.ex b/lib/helpers/parser.ex index f6ac2f2..a81f422 100644 --- a/lib/helpers/parser.ex +++ b/lib/helpers/parser.ex @@ -224,8 +224,7 @@ defmodule Helper.Parser do parser(:do, "1") parser(:gd, "1") parser(:gu, "1") - parser(:jm1, "1") - parser(:jm2, "1") + parser(:jm, "1") parser(:kn, "1") parser(:ky, "1") parser(:lc, "1") diff --git a/lib/phone/nanp.ex b/lib/phone/nanp.ex index 9e6811f..69c987b 100644 --- a/lib/phone/nanp.ex +++ b/lib/phone/nanp.ex @@ -15,8 +15,7 @@ defmodule Phone.NANP do Phone.NANP.DO, Phone.NANP.GD, Phone.NANP.GU, - Phone.NANP.JM1, - Phone.NANP.JM2, + Phone.NANP.JM, Phone.NANP.KN, Phone.NANP.KY, Phone.NANP.LC, diff --git a/lib/phone/nanp/jm1.ex b/lib/phone/nanp/jm.ex similarity index 51% rename from lib/phone/nanp/jm1.ex rename to lib/phone/nanp/jm.ex index 4a86c26..4cdfdd2 100644 --- a/lib/phone/nanp/jm1.ex +++ b/lib/phone/nanp/jm.ex @@ -1,12 +1,12 @@ -defmodule Phone.NANP.JM1 do +defmodule Phone.NANP.JM do @moduledoc false use Helper.Country - def regex, do: ~r/^(1)(876)([2-9].{6})$/ + def regex, do: ~r/^(1)(658|876)([2-9].{6})$/ def country, do: "Jamaica" def a2, do: "JA" def a3, do: "JAM" - matcher(:regex, ["1876"]) + matcher(:regex, ["1658", "1876"]) end diff --git a/lib/phone/nanp/jm2.ex b/lib/phone/nanp/jm2.ex deleted file mode 100644 index edb30e8..0000000 --- a/lib/phone/nanp/jm2.ex +++ /dev/null @@ -1,12 +0,0 @@ -defmodule Phone.NANP.JM2 do - @moduledoc false - - use Helper.Country - - def regex, do: ~r/^(1)(658)([2-9].{6})$/ - def country, do: "Jamaica" - def a2, do: "JA" - def a3, do: "JAM" - - matcher(:regex, ["1658"]) -end From 54101beb8babb17d030a7c8318f48a31644f2774 Mon Sep 17 00:00:00 2001 From: Cevado Date: Tue, 29 Dec 2020 17:52:57 -0300 Subject: [PATCH 4/5] v0.5.2 --- CHANGELOG.md | 5 +++++ mix.exs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 518a6f8..d39ca0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## v0.5.2 + +* Update regex for Jamaica to support new region code. +* Fix typo on Saint Vincent and the Grenadines country name. + ## v0.5.1 * Update regex for Singapore to support 10 digits number. diff --git a/mix.exs b/mix.exs index 72a3435..b7defcb 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule Phone.Mixfile do def project do [ app: :phone, - version: "0.5.1", + version: "0.5.2", elixir: ">= 1.1.0", build_embedded: Mix.env() == :prod, start_permanent: Mix.env() == :prod, From 7b3f9aee08792dc5f383982d6c087dc49783f001 Mon Sep 17 00:00:00 2001 From: Cevado Date: Tue, 29 Dec 2020 18:15:45 -0300 Subject: [PATCH 5/5] Fix identation on changelog.md --- CHANGELOG.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d39ca0c..1b8fda9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,41 +2,41 @@ ## v0.5.2 -* Update regex for Jamaica to support new region code. -* Fix typo on Saint Vincent and the Grenadines country name. + * Update regex for Jamaica to support new region code. + * Fix typo on Saint Vincent and the Grenadines country name. ## v0.5.1 -* Update regex for Singapore to support 10 digits number. + * Update regex for Singapore to support 10 digits number. ## v0.5.0 -* Add support to region codes for Spain. + * Add support to region codes for Spain. ## v0.4.11 -* Update regex for Belgium. + * Update regex for Belgium. ## v0.4.10 -* Add new area codes for US, California. -* Update regex for Netherlands + * Add new area codes for US, California. + * Update regex for Netherlands ## v0.4.9 -* Add Vancouver missing area code + * Add Vancouver missing area code ## v0.4.8 -* Add brazilian toll free numbers + * Add brazilian toll free numbers ## v0.4.6 -* Fix max length for German numbers to 11 + * Fix max length for German numbers to 11 ## v0.4.5 -* Fix Italy regex to consider 3 minimum digits and max 12 + * Fix Italy regex to consider 3 minimum digits and max 12 ## v0.4.4: * Fix Australia regex