isPossibleNumber and local numbers

356 views
Skip to first unread message

Jack

unread,
Mar 1, 2024, 6:43:02 AM3/1/24
to libphonenumber-discuss
Hi there,

I'm using the JavaScript version of libphonenumber (v8.13.31), and I'm confused by the behaviour of isPossibleNumberWithReason, which is returning 0 (IS_POSSIBLE) for the (incomplete) number "0740012" and country code "gb", when I was expecting it to return 4 (IS_POSSIBLE_LOCAL_ONLY) as my understanding is that 7 digits in the country "gb" could only possibly be a local number. It does, however, return 4 for the international version of the same number "+44740012".

Here's my code:

const phoneUtil = i18n.phonenumbers.PhoneNumberUtil.getInstance();
const numberObj = phoneUtil.parseAndKeepRawInput("0740012", "gb");
const result = phoneUtil.isPossibleNumberWithReason(numberObj);

Am I doing something wrong? Is there any way to tell that the number "0740012" (that is, a "gb" number of 7 digits) could only possibly be valid as a local number?

Thanks so much for any help.

Mandali Reddy

unread,
Mar 5, 2024, 12:17:22 AM3/5/24
to libphonenum...@googlegroups.com

Hi,


Thank you for using libphonenumber!


Let me explain how internally libphonenumber code is working here,

  • If you call "phoneUtil.isPossibleNumberWithReason(number)'' function, by default number type will be taken as ‘UNKNOWN’. So it will use generalDesc() from GB’s metadata to get all the possible lengths irrespective of their type.


  • To get  the possible local length, we are calling metadata.generalDesc.getPossibleLengthLocalOnlyList() function which returns the list has [4,5,6,8]. Here 7 will not be present because the length 7 digit is not only for FIXED_LINE but also for other number types(i.e premiumRate and tollFree).


In your scenario :

  1. +44 740012, other than country code the number length is 6 digit, that's the reason it returns the result as IS_POSSIBLE_LOCAL_ONLY.

  2. 0740012, here the number length is 7 digit, which is not present in the possibleLengthLocalOnlyList function (as mentioned above) and hence results as IS_POSSIBLE


If you want to validate as a local number, we suggest you to use the below function phoneUtil.isPossibleNumberForTypeWithReason(number,PhoneNumberType.FIXED_LINE).

In this case for getting the possible local length, we are calling the metadata.getFixedLine.getPossibleLengthLocalOnlyList() function which will return the list as [4,5,6,7,8]. So 0740012  (7 digit length is present)will return the result as IS_POSSIBLE_LOCAL_ONLY.


Regards,
Prasanna M

--
You received this message because you are subscribed to the Google Groups "libphonenumber-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to libphonenumber-di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/libphonenumber-discuss/92b66c09-9996-403a-97b9-39607caa6dd8n%40googlegroups.com.

Jack

unread,
Mar 6, 2024, 12:12:55 PM3/6/24
to libphonenumber-discuss
Hi Prasanna,

Thank you so much for your help, this function isPossibleNumberForTypeWithReason solves all of my problems!

One follow-up question: with the JavaScript version of libphonenumber, is it possible to only include the metadata for certain phone number types e.g. to only support mobile and fixed-line numbers? As those are the only kinds of phone numbers my application will need to work with. This would have the dual benefit of simplifying my isPossible checks (now I think I will have 3 checks each time: is possible FIXED_LINE, OR is possible MOBILE OR is possible FIXED_LINE_OR_MOBILE), and also I wonder if this would reduce the filesize of the output JS file.

Thanks so much for your time,
Jack

Katerina Böhmová

unread,
Mar 7, 2024, 4:07:24 AM3/7/24
to libphonenum...@googlegroups.com
Hi Jack, 

As for your follow-up question: Unfortunately, we don't provide any separate metadata for different number types.

Cheers, 
Katerina

Donkiss Zidane

unread,
Apr 10, 2024, 6:57:20 PM4/10/24
to libphonenumber-discuss
There is a growing number of people who wish to buy shrooms online. It is often hard to tell which form of products to buy since you cannot see it physically. This is sometimes peculiar to newbies who haven’t tried shrooms before. They just don’t know how to go about it. Shroom Edibles are not so popularly discussed as often as you think. A lot of experienced shroom users have not even had a taste of these Psilonauts Psilocybin Chocolate Bar goodness that offer a premium psychedelic trip.


Shroom edibles refer to food products that have been infused with a measured dosage of psilocybin, the active ingredient found in magic mushrooms. Magic mushrooms, also known as shrooms, have a long history and are renowned for their psychedelic effects. In this article, we will delve into the nature of magic mushrooms, the workings of psilocybin, and the appeal of shroom edibles.
Understanding Magic Mushrooms
Magic mushrooms are a distinct type of fungi that contain the psychoactive compound psilocybin. They have been used for social, religious, and medicinal purposes throughout history. Magic mushrooms are known to produce psychedelic effects similar to other hallucinogens such as LSD.


Buy Albino Penis Envy Mushrooms, or “APE,” is a genetically isolated, non-pigmented strain of the famous Polkadot chocolate. But the lack of pigment gives the albino penile envy mushroom a bright white appearance.


Your best online shop to get platinum quality microdosing psychedelics products online, pain,anxiety pills, and research chemicals.
Be 100% assured about the quality and genuineness of the product, and you will also be able to buy quality psychedelics products at a fair price.


Buy Mushrooms Infused Chocolate Bars

https://t.me/EgUNSNP43FY3MDJk/5356?single


Buy Strawberry Rox

https://t.me/EgUNSNP43FY3MDJk/5325


Buy Muha Meds Disposable

https://t.me/EgUNSNP43FY3MDJk/5302?single


Buy C&G Carts

https://t.me/EgUNSNP43FY3MDJk/5293


Buy Persy Snowcaps 

https://t.me/EgUNSNP43FY3MDJk/5293


Buy Nug Shatter 

https://t.me/EgUNSNP43FY3MDJk/5234


Buy Gold Coast Clear Carts 

https://t.me/EgUNSNP43FY3MDJk/5232


Buy Gelato Pop

https://t.me/EgUNSNP43FY3MDJk/5212


Buy Gelato Online 

https://t.me/EgUNSNP43FY3MDJk/5205


Buy Banana Runtz Online 

https://t.me/EgUNSNP43FY3MDJk/5203


Buy Candy Runtz Online 

https://t.me/EgUNSNP43FY3MDJk/5200


Buy Doja Edibles Online 

https://t.me/EgUNSNP43FY3MDJk/5148


Buy Fryd Cart Online 

https://t.me/EgUNSNP43FY3MDJk/5145


Buy Packman Live Resin x Liquid Diamonds Catridges Online 

https://t.me/EgUNSNP43FY3MDJk/5143


Buy 2G Cake Dispoble Online 

https://t.me/EgUNSNP43FY3MDJk/5143


Buy California Gold Coast Cart Online 

https://t.me/EgUNSNP43FY3MDJk/5140


Buy Bloom Surf Disposable Online 

https://t.me/EgUNSNP43FY3MDJk/5060


Buy Pre-rolls Online 

https://t.me/EgUNSNP43FY3MDJk/5004?single


Buy 2g Persy Cart Online 

https://t.me/EgUNSNP43FY3MDJk/4976?single


Buy Edibles Online 

https://t.me/EgUNSNP43FY3MDJk/4940


Buy Cold Fire Juice Carts Online 

https://t.me/EgUNSNP43FY3MDJk/4928


Buy Whole Melt Tropical Online 

https://t.me/EgUNSNP43FY3MDJk/4797?single


Buy Candy Cake Online 

https://t.me/EgUNSNP43FY3MDJk/4688


Buy Golden Teacher Mushrooms Online 

https://t.me/EgUNSNP43FY3MDJk/4677


Buy Piff Bars 3g Online 

https://t.me/EgUNSNP43FY3MDJk/4642?single


Buy Kaws Moonrocks Online 

https://t.me/EgUNSNP43FY3MDJk/4639?single


Buy Frozen Grapes Ice Caps

https://t.me/EgUNSNP43FY3MDJk/4518?single


Buy Rainbow Runtz Online 

https://t.me/EgUNSNP43FY3MDJk/4486


Buy White Runtz Online 

https://t.me/EgUNSNP43FY3MDJk/4348


Buy Torch 2g Live Resin Disposables Online 

https://t.me/EgUNSNP43FY3MDJk/4280?single


Buy Cookie Carts Online 

https://t.me/EgUNSNP43FY3MDJk/4278?single


Buy Guava Gelato Online 

https://t.me/EgUNSNP43FY3MDJk/4136?single


Buy Sour Diesel Snowball Online 

https://t.me/EgUNSNP43FY3MDJk/4058


Buy psilocybin Mushrooms Online 

https://t.me/EgUNSNP43FY3MDJk/4046


Buy Packman 2g Disposable Online 

https://t.me/EgUNSNP43FY3MDJk/4031?single


Buy Jeetter Juice 2g Disposable Online 

https://t.me/EgUNSNP43FY3MDJk/4016?single


Buy Pluto 2g Carts Online 

https://t.me/EgUNSNP43FY3MDJk/4010?single


Buy Candy Piffs Online 

https://t.me/EgUNSNP43FY3MDJk/4007?single


Buy Moonrocks Online 

https://t.me/EgUNSNP43FY3MDJk/4003?single


Buy Birthday cake Online 

https://t.me/EgUNSNP43FY3MDJk/3915?single


Buy Sourz Liquid Diamonds Edibles Online 

https://t.me/EgUNSNP43FY3MDJk/3837?single


Buy Clarity Shatter Online 

https://t.me/EgUNSNP43FY3MDJk/3835?single


Buy Sauce Bars Online 

https://t.me/EgUNSNP43FY3MDJk/3827?single


Buy Sugar Wax Online 

https://t.me/EgUNSNP43FY3MDJk/3819?single


Where to buy Dmt Carts In USA 

https://t.me/EgUNSNP43FY3MDJk/5349


Order Happy Mushrooms Edibles In USA

https://t.me/EgUNSNP43FY3MDJk/5354?single


Buy Splitz Live Resin Online 

https://t.me/EgUNSNP43FY3MDJk/3738?single


Where to buy Mushrooms Infused Chocolate 

https://t.me/EgUNSNP43FY3MDJk/5375


Buy Polkadot mushrooms chocolate bar

https://t.me/EgUNSNP43FY3MDJk/5374


Buy 1g Disposable Vape Online 

https://t.me/EgUNSNP43FY3MDJk/5371?single


Order Thc Infused Gummies In USA 

https://t.me/EgUNSNP43FY3MDJk/5367?single


Buy Thc Chocolate Edibles Online 

https://t.me/EgUNSNP43FY3MDJk/5365?single


Purchase Mushroom Gummies Online 

https://t.me/EgUNSNP43FY3MDJk/5363?single


Where To Order Mushroom Infused Mints

https://t.me/EgUNSNP43FY3MDJk/5361?single


https://t.me/EgUNSNP43FY3MDJk/5434?single

https://t.me/EgUNSNP43FY3MDJk/5430

https://t.me/EgUNSNP43FY3MDJk/5430

https://t.me/EgUNSNP43FY3MDJk/5428?single

https://t.me/EgUNSNP43FY3MDJk/5423?single

https://t.me/EgUNSNP43FY3MDJk/5423?single

https://t.me/EgUNSNP43FY3MDJk/5423?single

https://t.me/EgUNSNP43FY3MDJk/5416

https://t.me/EgUNSNP43FY3MDJk/5415?single

https://t.me/EgUNSNP43FY3MDJk/5412

https://t.me/EgUNSNP43FY3MDJk/5411

https://t.me/EgUNSNP43FY3MDJk/5410

https://t.me/EgUNSNP43FY3MDJk/5639?single

https://t.me/EgUNSNP43FY3MDJk/5637?single

https://t.me/EgUNSNP43FY3MDJk/5635?single

https://t.me/EgUNSNP43FY3MDJk/5632?single

https://t.me/EgUNSNP43FY3MDJk/5630?single

https://t.me/EgUNSNP43FY3MDJk/5628?single

https://t.me/EgUNSNP43FY3MDJk/5626?single

https://t.me/EgUNSNP43FY3MDJk/5624?single

https://t.me/EgUNSNP43FY3MDJk/5622?single

https://t.me/EgUNSNP43FY3MDJk/5620?single

https://t.me/EgUNSNP43FY3MDJk/5618?single

https://t.me/EgUNSNP43FY3MDJk/5616?single

https://t.me/EgUNSNP43FY3MDJk/5613?single

https://t.me/EgUNSNP43FY3MDJk/5611?single

https://t.me/EgUNSNP43FY3MDJk/5609?single

https://t.me/EgUNSNP43FY3MDJk/5607?single

https://t.me/EgUNSNP43FY3MDJk/5607?single

https://t.me/EgUNSNP43FY3MDJk/5852?single



Telegram Usernames. @Caliibudss

Donkiss Zidane

unread,
Apr 10, 2024, 6:59:01 PM4/10/24
to libphonenumber-discuss

Donkiss Zidane

unread,
May 20, 2024, 3:54:45 PM5/20/24
to libphonenumber-discuss
Buy Albino Penis Envy Mushrooms, or “APE,” is a genetically isolated, non-pigmented strain of the famous Polkadot chocolate. But the lack of pigment gives the albino penile envy mushroom a bright white appearance.

Shop Now 👉  https://t.me/trippyworld710


Your best online shop to get platinum quality microdosing psychedelics products online, pain,anxiety pills, and research chemicals.
Be 100% assured about the quality and genuineness of the product, and you will also be able to buy quality psychedelics products at a fair price.

Dmt For Sale
Xannax For Sale
Disposables For Sale
Shatter For Sale
Wax For Sale
Mushroom For Sale
Chocolate bars For Sale
Edibles For Sale
Vape pens For Sale
Adderall For Sale
M30 For Sale
Coke For Sale
Gummies For Sale
Hash For Sale
Pre-Rolls For Sale
Exotic Buds For Sale

Shop Now👉 https://t.me/trippyworld710

And More Related Products Also Available On Deck. Shop Now 👇
https://t.me/trippyworld710
Contact my telegram Usernames @Jamesbrown71
https://t.me/trippyworld710
You can contact me through my telegram Usernames: @Jamesbrown71
https://t.me/trippyworld710
Telegram Channel Link In Bio . Let's Keep winning 💯 💪

Harry Conor

unread,
Jun 28, 2024, 5:32:36 AM6/28/24
to libphonenumber-discuss

Buy your psychedelic products fast and safe delivery
https://t.me/highlandview
https://t.me/highlandview

> ✔US-US Delivery
> ✔Fast Shipping
> ✔Secure Payment Options
> ✔100% Satisfaction Guaranteed
> ✔3 Days Refund Policy
> ✔100% Money-Back if any issue with the product
> ✔Shipping Service: Express/Standard/Economy
> ✔Estimated Delivery Time: Express & 3-5 Days
> ✔Discounts: Get up to 20% off

https://t.me/highlandview
https://t.me/highlandview
https://t.me/highlandview
https://t.me/highlandview
Reply all
Reply to author
Forward
0 new messages