I noticed that when inputting a phone number that doesn't match the pattern here will throw a Uncaught TypeError: Cannot read property '0' of null because phoneNumber is null and so we can't access the indicies for the groups.
I think it would be better to just return here rather than throw an error that doesn't really indicate why the function is failing. Is there reason why that was commented out?
I noticed that when inputting a phone number that doesn't match the pattern here will throw a
Uncaught TypeError: Cannot read property '0' of null
becausephoneNumber
is null and so we can't access the indicies for the groups.I think it would be better to just return here rather than throw an error that doesn't really indicate why the function is failing. Is there reason why that was commented out?
https://github.com/omarshammas/jquery.formance/blob/master/src/zfields/phone_number.coffee#L5-L7