Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added PhoneNumberMatcher #89

Open
wants to merge 31 commits into
base: main
Choose a base branch
from

Conversation

mauritsderuiter95
Copy link

I was trying to use your port of libphonenumber, but the PhoneNumberMatcher had to be implemented. I needed it for my project, so I ported it.

go.sum Outdated Show resolved Hide resolved
@@ -7,4 +7,4 @@ replace github.com/nyaruka/phonenumbers => ../../
require (
github.com/aws/aws-lambda-go v1.13.1
github.com/nyaruka/phonenumbers v0.0.0-00010101000000-000000000000
)
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

white spaces?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't have changed. I reset the file to an earlier commit

// international format (with a leading plus, or with the
// international dialing prefix of the specified region). May be
// "ZZ" if only numbers with a leading plus should be considered.
func NewPhoneNumberMatcher(text string, region string) PhoneNumberMatcher {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it should return the same type as before. And params are different too.

I understand that it wasn't implemented before, but still, everyone should see that this is a breaking change.

CC: @nicpottier

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get your point. But I'm not sure what to do here. Currently, the entire PhoneNumberMatcher isn't implemented at all, and the constructor function simply returns nil.

The new function doesn't do anything exciting, except keeping the struct fields private. If I export the "text", "preferredRegion", "leniency" and "maxTries", PhoneNumberMatcher could just be initialized without constructor function. Is that a better solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants