From a2034a0db1e70862a52b122c5d9e26bd8ba22a56 Mon Sep 17 00:00:00 2001 From: issuedat <165281975+issuedat@users.noreply.github.com> Date: Tue, 1 Oct 2024 12:43:53 +0200 Subject: [PATCH 1/5] chore: rename module to clerk/phonenumber --- examples/main.go | 2 +- go.mod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/main.go b/examples/main.go index e91268c..3160a46 100644 --- a/examples/main.go +++ b/examples/main.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/dongri/phonenumber" + "github.com/clerk/phonenumber" ) func main() { diff --git a/go.mod b/go.mod index 89b5d4b..f2c45f9 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module github.com/dongri/phonenumber +module github.com/clerk/phonenumber go 1.21 From 811df888c86f435a635c5ada3a13de4324a1dfe6 Mon Sep 17 00:00:00 2001 From: issuedat <165281975+issuedat@users.noreply.github.com> Date: Tue, 1 Oct 2024 12:46:45 +0200 Subject: [PATCH 2/5] fix: allow Guinea mobile phone numbers to have 9 digits --- iso3166.go | 2 +- phonenumber_test.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/iso3166.go b/iso3166.go index eff5362..b82b896 100644 --- a/iso3166.go +++ b/iso3166.go @@ -671,7 +671,7 @@ func populateISO3166() { i.CountryCode = "224" i.CountryName = "Guinea" i.MobileBeginWith = []string{"6"} - i.PhoneNumberLengths = []int{8} + i.PhoneNumberLengths = []int{8, 9} iso3166Datas = append(iso3166Datas, i) i.Alpha2 = "GP" diff --git a/phonenumber_test.go b/phonenumber_test.go index 0fb82b4..15aee01 100644 --- a/phonenumber_test.go +++ b/phonenumber_test.go @@ -73,6 +73,7 @@ var mobFormatTests = []struct { {"+51 912 640 074", "PE", "51912640074"}, {"+86 18 855 512 329", "CN", "8618855512329"}, {"+383 4 555 4999", "XK", "38345554999"}, + {"+224629295237", "GN", "224629295237"}, } func TestFormatMobile(t *testing.T) { @@ -143,6 +144,7 @@ var mobWithLLFormatTests = []struct { {"+51 999 400 500", "PE", "51999400500"}, {"+86 (16) 855-512-329", "CN", "8616855512329"}, {"+383 4 1234999", "XK", "38341234999"}, + {"+224629295237", "GN", "224629295237"}, } func TestFormatWithLandLine(t *testing.T) { @@ -305,6 +307,7 @@ var mobCountryTests = []struct { {"51907061970", "PE", true}, {"8613855512329", "CN", true}, {"38361234999", "XK", true}, + {"224629295237", "GN", true}, } func TestGetCountryForMobileNumber(t *testing.T) { From d29021d1dc10a7aeb0aa46ac62916eae3a4b9a71 Mon Sep 17 00:00:00 2001 From: issuedat <165281975+issuedat@users.noreply.github.com> Date: Thu, 17 Oct 2024 10:45:58 +0200 Subject: [PATCH 3/5] USER-847: Support French Polynesia Numbers (#1) --- iso3166.go | 4 ++-- phonenumber_test.go | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/iso3166.go b/iso3166.go index b82b896..0cd990f 100644 --- a/iso3166.go +++ b/iso3166.go @@ -1422,8 +1422,8 @@ func populateISO3166() { i.Alpha3 = "PYF" i.CountryCode = "689" i.CountryName = "French Polynesia" - i.MobileBeginWith = []string{} - i.PhoneNumberLengths = []int{6} + i.MobileBeginWith = []string{"87", "88", "89"} + i.PhoneNumberLengths = []int{6, 8} iso3166Datas = append(iso3166Datas, i) i.Alpha2 = "QA" diff --git a/phonenumber_test.go b/phonenumber_test.go index 15aee01..76d4a51 100644 --- a/phonenumber_test.go +++ b/phonenumber_test.go @@ -74,6 +74,7 @@ var mobFormatTests = []struct { {"+86 18 855 512 329", "CN", "8618855512329"}, {"+383 4 555 4999", "XK", "38345554999"}, {"+224629295237", "GN", "224629295237"}, + {"+68989657111", "PF", "68989657111"}, } func TestFormatMobile(t *testing.T) { @@ -145,6 +146,7 @@ var mobWithLLFormatTests = []struct { {"+86 (16) 855-512-329", "CN", "8616855512329"}, {"+383 4 1234999", "XK", "38341234999"}, {"+224629295237", "GN", "224629295237"}, + {"+68989657111", "PF", "68989657111"}, } func TestFormatWithLandLine(t *testing.T) { @@ -308,6 +310,7 @@ var mobCountryTests = []struct { {"8613855512329", "CN", true}, {"38361234999", "XK", true}, {"224629295237", "GN", true}, + {"68989657111", "PF", true}, } func TestGetCountryForMobileNumber(t *testing.T) { From b4230cb2cbb466a7bb4e7faf0bd66af33a84ed95 Mon Sep 17 00:00:00 2001 From: Roy Anger Date: Wed, 9 Apr 2025 17:04:57 -0400 Subject: [PATCH 4/5] chore: Updated for Myanmar numbers --- iso3166.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iso3166.go b/iso3166.go index 0cd990f..fe6bd94 100644 --- a/iso3166.go +++ b/iso3166.go @@ -1134,8 +1134,8 @@ func populateISO3166() { i.Alpha3 = "MMR" i.CountryCode = "95" i.CountryName = "Myanmar" - i.MobileBeginWith = []string{"9"} - i.PhoneNumberLengths = []int{8} + i.MobileBeginWith = []string{"9", "09"} + i.PhoneNumberLengths = []int{8, 10, 11} iso3166Datas = append(iso3166Datas, i) i.Alpha2 = "ME" From 67011a247774f42d3929e8ca74780dd6c33794a0 Mon Sep 17 00:00:00 2001 From: Nikos Polykandriotis Date: Mon, 14 Apr 2025 12:00:26 +0300 Subject: [PATCH 5/5] chore: Add tests for MM --- iso3166.go | 2 +- phonenumber_test.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/iso3166.go b/iso3166.go index fe6bd94..bdd293a 100644 --- a/iso3166.go +++ b/iso3166.go @@ -1134,7 +1134,7 @@ func populateISO3166() { i.Alpha3 = "MMR" i.CountryCode = "95" i.CountryName = "Myanmar" - i.MobileBeginWith = []string{"9", "09"} + i.MobileBeginWith = []string{"9"} i.PhoneNumberLengths = []int{8, 10, 11} iso3166Datas = append(iso3166Datas, i) diff --git a/phonenumber_test.go b/phonenumber_test.go index 76d4a51..2120a1e 100644 --- a/phonenumber_test.go +++ b/phonenumber_test.go @@ -75,6 +75,7 @@ var mobFormatTests = []struct { {"+383 4 555 4999", "XK", "38345554999"}, {"+224629295237", "GN", "224629295237"}, {"+68989657111", "PF", "68989657111"}, + {"+959452929499", "MM", "959452929499"}, } func TestFormatMobile(t *testing.T) { @@ -147,6 +148,7 @@ var mobWithLLFormatTests = []struct { {"+383 4 1234999", "XK", "38341234999"}, {"+224629295237", "GN", "224629295237"}, {"+68989657111", "PF", "68989657111"}, + {"+959452929499", "MM", "959452929499"}, } func TestFormatWithLandLine(t *testing.T) { @@ -311,6 +313,7 @@ var mobCountryTests = []struct { {"38361234999", "XK", true}, {"224629295237", "GN", true}, {"68989657111", "PF", true}, + {"959452929499", "MM", true}, } func TestGetCountryForMobileNumber(t *testing.T) {