You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This might be an edge case, but I am using this gem to validate zip codes entered into a search field. I need to be able to make sure that "012" throws an error. However, since your to_region method treats a string length of 3 as an area code, "012".to_region is returning nil when I'm expecting an error.
I would create separate methods for processing area codes versus zip codes. And when checking zip codes, I wouldn't just check if the length is 5, I would check that the string is in the right format using this regex: /^\d{5}(-\d{4})?$/
Thoughts?
The text was updated successfully, but these errors were encountered:
Sorry for the late response. I'm able to concentrate on this after being quite busy for the last few months. I like both of these suggestions. In the 1.0 version of Area they will both be included and there will be no methods that have the ability to operate on both zipcodes and area codes.
Please send any more suggestions my way and follow along on the dev branch.
This might be an edge case, but I am using this gem to validate zip codes entered into a search field. I need to be able to make sure that "012" throws an error. However, since your
to_region
method treats a string length of 3 as an area code, "012".to_region is returning nil when I'm expecting an error.I would create separate methods for processing area codes versus zip codes. And when checking zip codes, I wouldn't just check if the length is 5, I would check that the string is in the right format using this regex:
/^\d{5}(-\d{4})?$/
Thoughts?
The text was updated successfully, but these errors were encountered: