0.0
The project is in a healthy, maintained state
Find US state by ZIP code
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

state_by_zip

Single purpose gem to find US states by ZIP codes. It takes the idea of matching ZIP codes against SCF prefixes from https://github.com/monicao/zip-code-info, but is also adjusted for special cases like "00210".

The gem doesn't call external APIs and the lookup data is less than 10kb.

In case of ZIP codes spreading across multiple states only the primary one is returned (as shown in https://www.unitedstateszipcodes.org).

Usage

StateByZip.find(12345)
# => "NY"

StateByZip.find('00987')
# => "PR"

Alternatives

If you need to identify cities or time zones you can use https://github.com/monterail/zip-codes instead.