@zerodep/geo-state
TypeScript icon, indicating that this package has built-in type declarations

2.3.4 • Public • Published

@zerodep/geo-state

version language types license

CodeFactor Known Vulnerabilities

A parser to get state abbreviation and information from a state name or abbreviation; it will throw a ZeroDepError if the guard fails.

Full documentation is available at the zerodep.app page.

Examples

geoStateIso Examples

geoStateIso('n.y.'); // ['NY', 'US']
geoStateIso('oreg'); // ['OR', 'US']
geoStateIso('alberta'); // ['AB', 'CA']

geoState Examples

geoState(['utah']);
// {
//   stateName: 'Utah',
//   stateAbbr: 'UT',
//   stateFips: '49',
//   regionCensus: 'West',
//   regionDivision: 'Mountain',
//   regionBea: 'Rocky Mountain',
//   countryName: 'United States',
//   countryIso2: 'US',
// }

geoState('bc');
// {
//   stateName: 'British Columbia',
//   stateAbbr: 'BC',
//   stateFips: '00',
//   regionCensus: undefined,
//   regionDivision: undefined,
//   regionBea: undefined,
//   countryName: 'Canada',
//   countryIso2: 'CA',
// }

Unsuccessful Cases

geoStateIso('unknown'); // thows ZeroDepError: Could not find a state or province for "UNKNOWN"

geoState('unknown'); // thows ZeroDepError: Could not find a state or province for "UNKNOWN"

Readme

Keywords

Package Sidebar

Install

npm i @zerodep/geo-state

Homepage

zerodep.app

Weekly Downloads

0

Version

2.3.4

License

MIT

Unpacked Size

90.4 kB

Total Files

7

Last publish

Collaborators

  • cdepage