daddyz / phonelib

Ruby gem for phone validation and formatting using google libphonenumber library data
MIT License
1.04k stars 130 forks source link

String inside number shows valid #265

Closed rajanverma-me closed 1 year ago

rajanverma-me commented 1 year ago

The command below evaluates to true;

Phonelib.valid_for_country? "91977947ada1801", :in

I don't think any country has this pattern of phone numbers. This should be a general case failure.

daddyz commented 1 year ago

@rajanverma-me Phonelib does sanitization prior to parsing, but you can enable strict check in initializer

Phonelib.valid_for_country?("91977947ada1801", :in) # => true 

Phonelib.strict_check = true
Phonelib.valid_for_country?("91977947ada1801", :in) # => false
Phonelib.valid_for_country?("919779471801", :in) # => true