0.0.1-next.0 • Published 2 years ago
@standardsets/us-states v0.0.1-next.0
Utilities for querying U.S. States names, and their equivalent variations/abbreviations.
Install
Via npm
npm install -S @standardsets/us-states
Via Yarn
yarn add @standardsets/us-states
Dataset Options
Variations
Passing the appropriate variation.key
(enumerator VariationKey
) is how either
lists of U.S. State names are returned in the requested variation, or allow for
one variation to be returned in another format (ex. fullName
→ postalCode
or postalCode
→ fullName
)
fullName
|VariationKey.FULL_NAME
(default) - Full U.S. name, capitalized.postalCode
|VariationKey.POSTAL_CODE
- 2-letter codes by the United States Postal ServiceapStyle
|VariationKey.AP_STYLE
- Name abbreviations from the AP StylebookgpoStyle
|VairationKey.GPO_STYLE
- Official US Government Printing Office abbreviations
How to use
import { getAlternate, VariationKey } from '@standardsets/us-states'
const postalCode = getAlternate('Ohio', VariationKey.POSTAL_CODE)
console.debug(postalCode) // Outputs: 'OH'
Methods
getVariations
- Listing of available variations for the current data set.getVariationItems
- Query data set and return the specified variation items. Defaults tofullName
.getItemVariation
- Allows for swapping one variation for another. (ex.fullName
→postalCode
|Ohio
→OH
)
License
0.0.1-next.4
2 years ago
0.0.1-next.3
2 years ago
0.0.1-next.2
2 years ago
0.0.1-next.1
2 years ago
0.0.1-next.0
2 years ago