Skip to content

duner/statestyle-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StatestyleJS

StatestyleJS is a Javascript port of latimes-statestyle—a Python library that standardizes the names of U.S. states.

Submit a state’s name, postal code or Associated Press abbreviation or FIPS code and receive a clean object with all other formats as attributes. State objects also provide the “stateface” code for ProPublica’s webfont of state shapes.

###Usage

Just pass a state's name, postal code, or even Associated Press abbreviation into statestyle.get():

> a = statestyle.get('IL')
{ name: 'Illinois',
  postal: 'IL',
  fips: '17',
  ap: 'Ill.',
  type: 'state',
  stateface: 'N' }
> a.name
'Illinois'
> a.ap
'Ill.'

Or pass in a state's FIPS code:

> statestyle.get(15)
{ name: 'Hawaii',
  postal: 'HI',
  fips: '15',
  ap: 'Hawaii',
  type: 'state',
  stateface: 'K' }

About

A port of latimes-statestyle from Python to Javascript.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published