https://github.com/mdb/madison
A dirt simple Node.js module for working with US state names and abbreviations.
https://github.com/mdb/madison
Last synced: about 1 year ago
JSON representation
A dirt simple Node.js module for working with US state names and abbreviations.
- Host: GitHub
- URL: https://github.com/mdb/madison
- Owner: mdb
- License: mit
- Created: 2012-10-01T12:42:40.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2023-03-04T12:27:14.000Z (over 3 years ago)
- Last Synced: 2025-03-25T17:49:31.221Z (about 1 year ago)
- Language: JavaScript
- Size: 184 KB
- Stars: 4
- Watchers: 2
- Forks: 7
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/mdb/madison)
# madison
A dirt simple Node.js module for working with US state names and abbreviations.
## Usage
```javascript
const madison = require('madison');
// Get a state's abbreviation
console.log(madison.getStateAbbrev('virginia')); // 'VA'
console.log(madison.getStateAbbrev('vIrgiNia')); // 'VA'
console.log(madison.getStateAbbrev('foo')); // undefined
// Get a state's name
console.log(madison.getStateName('va')); // 'Virginia'
console.log(madison.getStateName('vA')); // 'Virginia'
console.log(madison.getStateName('foo')); // undefined
// Get a JSON array of US states, each containing 'name' and 'abbr' properties:
madison.states;
```
## Version 2.0.0 Breaking Changes
`*Sync` methods have been renamed to no longer have the `Sync` suffix, and async method versions have been removed to simplify the API, as no asyncronous calls were truly necessary.
All previously async methods now simply return a value synchronously, and do not accept a callback argument (it will be ignored if passed). All usages of previously synchronous methods can be upgraded by simply removing the `*Sync` suffix and will continue to work the same.