Closed aisler-ma closed 4 weeks ago
@aisler-ma interesting request, well, take this one as example, it works where there are multiple possibilities:
phone = Phonelib.parse("1 (787) 240-2750")
phone.countries # => ["AG", "AI", "AS", "BB", "BM", "BS", "CA", "DM", "DO", "GD", "GU", "JM", "KN", "KY", "LC", "MP", "MS", "PR", "SX", "TC", "TT", "US", "VC", "VG", "VI"]
phone.valid_countries # => ["PR"]
Hi all together,
awesome library and works pretty good! However, I noticed one issue: if one defines multiple countries to check—either via default values or as parameter—the tool check for all countries where the phone number is valid/possible, however returns only the first valid result. This is okay, if one wants to guess and just want to get one single result. However, it is also kind of confusing, and I have a use case where I want to check if the given number is possible in more than one country.
I also found the responsible line of code: https://github.com/daddyz/phonelib/blob/master/lib/phonelib/phone_analyzer_helper.rb#L12
I was wondering why you do this and/or if there's a way to get a list of all countries where the number is valid*?
Thanks in advance and best!
.countries
but it returned only one (the guessed) country.