jgv / area

Perform a variety of conversions between places and area codes or zip codes.
http://jonathanvingiano.com/area
MIT License
176 stars 58 forks source link

When postal code is not found to_region method returns entire hash of postal codes and regions #4

Closed serv closed 12 years ago

serv commented 12 years ago

If you use "9888" as the postal code, and do to_region on it, you get the entire hash of regions.

I don't think this is useful. It would make more sense to return [] so that we can check that the the postal code is invalid.

jgv commented 12 years ago

In this instance would you expect #to_region to return an empty array or to return nil?

serv commented 12 years ago

I think either should be fine. Either one of them would be a better indication that the postal code is not valid.

jgv commented 12 years ago

True. Alternatively it could throw a not found error.