@ewarren/unitedstatesofamerica

1.1.1 • Public • Published

unitedstatesofamerica

Convert a two–letter state abbreviation to the full state name. Supports US territories and armed forces designations.

Setup

$ npm install @ewarren/unitedstatesofamerica

Usage

Convert a two-letter code to the name of a state

import { lookup } from '@ewarren/unitedstatesofamerica';

lookup('NY'); // => 'New York'

Lookup the Spanish translation for a state

import { lookup, SPANISH } from '@ewarren/unitedstatesofamerica';

lookup('NY', SPANISH); // => 'Nueva York'

Reverse lookup the code of a state based on its name

import { reverseLookup } from '@ewarren/unitedstatesofamerica';

reverseLookup('Guam'); // => 'GU'

Access the raw data

import {
  states,
  territories,
  associations,
  armedForces,
  all,
} from '@ewarren/unitedstatesofamerica';

Local development

To run tests (requires Docker),

$ make tests

Dependencies (0)

    Dev Dependencies (6)

    Package Sidebar

    Install

    npm i @ewarren/unitedstatesofamerica

    Weekly Downloads

    4

    Version

    1.1.1

    License

    MIT

    Unpacked Size

    13.7 kB

    Total Files

    11

    Last publish

    Collaborators

    • itsjoekent
    • jschultz21
    • jjandoc