Closed PaparazzoKid closed 3 years ago
For numbers containing more than 18 numerical characters,
parsePhoneNumber()
returns undefined using either max or min metadata.
Yes, because it's assumed a non-valid phone number, same as Google's library does.
However, I'm guessing that any given value should return with an object but return false when checking isValid().
No.
For numbers containing more than 18 numerical characters,
parsePhoneNumber()
returnsundefined
using either max or min metadata.A given number can be 18 numerical characters long with any additional spaces, brackets or hyphens and work fine, but one more numerical digit will fail.
This is obviously and easy fix for me, as I assume
undefined
means it's an invalid phone number? However, I'm guessing that any given value should return with an object but returnfalse
when checkingisValid()
.Tests
This returns with an object as expected (18 numerical long):
parsePhoneNumber('023203232332322322', 'GB)
This returns with an object as expected (18 numerical long with hyphens, brackets and spaces):
parsePhoneNumber('(023) 2032-32332322-322', 'GB)
This returns
undefined
(19 numerical long):parsePhoneNumber('0232032323323223222', 'GB)
This returns
undefined
(19 numerical long with hyphens, brackets and spaces):parsePhoneNumber('(023) 2032-32332322-3222', 'GB)