catamphetamine / libphonenumber-js

A simpler (and smaller) rewrite of Google Android's libphonenumber library in javascript
https://catamphetamine.gitlab.io/libphonenumber-js/
MIT License
2.77k stars 218 forks source link

parsePhoneNumberFromString.isValid() as vue computed prop throws an error #415

Closed 4l1c30zz closed 2 years ago

4l1c30zz commented 2 years ago

Hello, I recently updated the library and started to get new error) If I'm calling it outside of the component without any dynamic input the error is not exists.

Steps to reproduce

I reproduced the behavior in code pen : https://codepen.io/f1na3/pen/rNzvrGZ

Observed result

On input I'm getting TypeError: (intermediate value)(...) is undefined It is working fine with isValidPhoneNumber()

Expected result

I'm expecting that parsePhoneNumberFromString(this.phoneNumber,"IL").isValid() will work similar as isValidPhoneNumber(this.phoneNumber,"IL") (as it was before)

Google's demo link

Unfortunately This one is less relevant for my case

catamphetamine commented 2 years ago

Hello

Hi

If I'm calling it outside of the component without any dynamic input the error is not exists.

This means that the code you're running has a bug somewhere.

Perhaps your code doesn't check for parsePhoneNumberFromString(this.phoneNumber,"IL") being undefined or something.

catamphetamine commented 2 years ago

I'm closing it because no minimal example has been provided and the demo is too convoluted to look at.